mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	Silence -Wuseless-cast warning with GCC10
With GCC 10, the `static_cast<bool>` triggers the -Wuseless-cast warning. This commit changes the cast into `static_cast<const bool&>`: it achieves the same thing but doesn't trigger the warning thanks to the "gratuitous" type conversion to `const bool&`. As per references rules, `const bool&` should bind to anything, be it `const` or not, an rvalue or an lvalue, so I doubt that this change is breaking anything.
This commit is contained in:
		
				
					committed by
					
						
						Martin Hořeňovský
					
				
			
			
				
	
			
			
			
						parent
						
							3a15433d52
						
					
				
				
					commit
					dd5652933a
				
			@@ -56,7 +56,7 @@
 | 
				
			|||||||
            CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
 | 
					            CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \
 | 
				
			||||||
        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
 | 
					        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
 | 
				
			||||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
					        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
				
			||||||
    } while( (void)0, (false) && static_cast<bool>( !!(__VA_ARGS__) ) )
 | 
					    } while( (void)0, (false) && static_cast<const bool&>( !!(__VA_ARGS__) ) )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \
 | 
					#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user