mirror of
https://github.com/catchorg/Catch2.git
synced 2025-06-05 15:03:34 +00: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:
parent
0354d50278
commit
94425ad59b
3 changed files with 68 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue