mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Replace two dynamic_casts with static_casts
This eliminates two uses of RTTI in Catch.
This commit is contained in:
		@@ -234,10 +234,8 @@ namespace TestCaseTracking {
 | 
				
			|||||||
            SectionTracker* section = CATCH_NULL;
 | 
					            SectionTracker* section = CATCH_NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ITracker& currentTracker = ctx.currentTracker();
 | 
					            ITracker& currentTracker = ctx.currentTracker();
 | 
				
			||||||
            if( ITracker* childTracker = currentTracker.findChild( name ) ) {
 | 
					            if( ITracker* childTracker = currentTracker.findChild( name ) )
 | 
				
			||||||
                section = dynamic_cast<SectionTracker*>( childTracker );
 | 
					                section = static_cast<SectionTracker*>( childTracker );
 | 
				
			||||||
                assert( section );
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else {
 | 
					            else {
 | 
				
			||||||
                section = new SectionTracker( name, ctx, ¤tTracker );
 | 
					                section = new SectionTracker( name, ctx, ¤tTracker );
 | 
				
			||||||
                currentTracker.addChild( section );
 | 
					                currentTracker.addChild( section );
 | 
				
			||||||
@@ -265,10 +263,8 @@ namespace TestCaseTracking {
 | 
				
			|||||||
            IndexTracker* tracker = CATCH_NULL;
 | 
					            IndexTracker* tracker = CATCH_NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            ITracker& currentTracker = ctx.currentTracker();
 | 
					            ITracker& currentTracker = ctx.currentTracker();
 | 
				
			||||||
            if( ITracker* childTracker = currentTracker.findChild( name ) ) {
 | 
					            if( ITracker* childTracker = currentTracker.findChild( name ) )
 | 
				
			||||||
                tracker = dynamic_cast<IndexTracker*>( childTracker );
 | 
					                tracker = static_cast<IndexTracker*>( childTracker );
 | 
				
			||||||
                assert( tracker );
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else {
 | 
					            else {
 | 
				
			||||||
                tracker = new IndexTracker( name, ctx, ¤tTracker, size );
 | 
					                tracker = new IndexTracker( name, ctx, ¤tTracker, size );
 | 
				
			||||||
                currentTracker.addChild( tracker );
 | 
					                currentTracker.addChild( tracker );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user