-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Description
Bug Report
I wanted to check whether Catch 2.1.0 fixed all perf. regression from Catch Classic on a real world test suite, but using #define private public in test files causes compilation errors because of ODR violations.
One example:
In file included from /mnt/c/ubuntu/json/src/json.hpp:1800:0,
from /mnt/c/ubuntu/json/test/src/unit-iterators1.cpp:32:
/usr/include/c++/5/sstream:300:7: error: ‘struct std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::__xfer_bufptrs’ redeclared with different access
struct __xfer_bufptrs
^
test/CMakeFiles/test-iterators1.dir/build.make:62: recipe for target 'test/CMakeFiles/test-iterators1.dir/src/unit-iterators1.cpp.o' failed
This is caused by Catch no longer including <sstream> everywhere, so an attempt to redefine private to public also hits <sstream> header. It can be temporarily fixed by just force including <sstream> before including the json.hpp header, but it should be noted that doing #define private public and having it affect any part of the standard library in any TU using the standard library is UB.
Note: There are also several test files that rely on transitive stdlib includes from Catch and will not compile with newer version.
OS & Compiler: g++ 5.4 under WSL