Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest/CompilationTests.cpp
diff options
context:
space:
mode:
authorSergey Semushin2017-04-05 10:53:10 +0300
committerMartin Hořeňovský2017-04-05 09:53:10 +0200
commit94425ad59b3e9ac9e7eea151c5f7843b8047cc1e (patch)
treee1fc579eec76c430b2fdab48e3ce69301b24c4eb /projects/SelfTest/CompilationTests.cpp
parent0354d50278d725d52084601300eb955cee6756d8 (diff)
downloadcatch3-94425ad59b3e9ac9e7eea151c5f7843b8047cc1e.tar.gz
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.
Diffstat (limited to 'projects/SelfTest/CompilationTests.cpp')
-rw-r--r--projects/SelfTest/CompilationTests.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/projects/SelfTest/CompilationTests.cpp b/projects/SelfTest/CompilationTests.cpp
index 4aa969f3..ed1978f3 100644
--- a/projects/SelfTest/CompilationTests.cpp
+++ b/projects/SelfTest/CompilationTests.cpp
@@ -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