mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 04:07:10 +01:00 
			
		
		
		
	Add opt-in c++11 stream insertable check. (#877)
* Add opt-in c++11 stream insertable check. To opt-in, define CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK. Opt-in fixes #872 and should fix #757 as well.
This commit is contained in:
		 Sergey Semushin
					Sergey Semushin
				
			
				
					committed by
					
						 Martin Hořeňovský
						Martin Hořeňovský
					
				
			
			
				
	
			
			
			 Martin Hořeňovský
						Martin Hořeňovský
					
				
			
						parent
						
							0354d50278
						
					
				
				
					commit
					94425ad59b
				
			| @@ -51,3 +51,22 @@ TEST_CASE("#833") { | ||||
|     REQUIRE(templated_tests<int>(3)); | ||||
| } | ||||
|  | ||||
| // Test containing example where original stream insertable check breaks compilation | ||||
| #if defined (CATCH_CONFIG_CPP11_STREAM_INSERTABLE_CHECK) | ||||
| namespace { | ||||
|     struct A {}; | ||||
|     std::ostream& operator<< (std::ostream &o, const A &) { return o << 0; } | ||||
|  | ||||
|     struct B : private A { | ||||
|         bool operator== (int) const { return true; } | ||||
|     }; | ||||
|  | ||||
|     B f (); | ||||
|     std::ostream g (); | ||||
| } | ||||
|  | ||||
| TEST_CASE( "#872" ) { | ||||
|     B x; | ||||
|     REQUIRE (x == 4); | ||||
| } | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user