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 2017-04-05 10:53:10 +03:00 committed by Martin Hořeňovský
parent 0354d50278
commit 94425ad59b
3 changed files with 68 additions and 11 deletions

View file

@ -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