-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add StringMaker for std::variant, std::monostate #1380
Conversation
Add tests and document configuration macros.
Hm, seems the tests fail to compile on clang 6 + libstdc++ because of a bug: https://bugs.llvm.org/show_bug.cgi?id=31852 Edit: clang trunk has the fix, not sure about the upcoming 7.0 release, and gcc 8.2.0's libstdc++has the workaround for clang 6. |
You can try modifying Alternatively, I'll see what I can do on Monday. |
Codecov Report
@@ Coverage Diff @@
## master #1380 +/- ##
=======================================
Coverage 80.08% 80.08%
=======================================
Files 119 119
Lines 3389 3389
=======================================
Hits 2714 2714
Misses 675 675 |
Codecov Report
@@ Coverage Diff @@
## master #1380 +/- ##
==========================================
- Coverage 80.11% 80.08% -0.03%
==========================================
Files 119 119
Lines 3384 3389 +5
==========================================
+ Hits 2711 2714 +3
- Misses 673 675 +2 |
I tried changing it to libstdc++-8-dev, but that doesn't seem to make a difference. |
The output is the image's clang, later on Anyway, that sounds like it is time for more compile time configuration, specifically The basic scheme is to have a check like this #include <ciso646> // Get libstdc++ and libc++ version macros
#if defined(__CLANG__) && defined(_GLIBCXX_RELEASE) && (CLANG_MAJOR < 7) && (_GLIBCXX_RELEASE < 8)
// This combination of Clang and libstdc++ can't compile std::variant
#define CATCH_INTERNAL_CONFIG_NO_VARIANT
#endif I don't actually remember Clang's macros, but you get the idea 😃 |
I did some more testing, libstdc++ 8.2 has the workaround, 8.1 doesn't, clang trunk appears to have the fix, clang 7 nightly doesn't. |
Apparently So that leaves disabling the feature for all versions of libstdc++ <= 8, and letting the user override with |
Yeah, I am going to do a quick fixup and then squash + merge the PR into master. |
Description
Adds StringMaker specializations for
std::variant
andstd::monostate
, which can be enabled withCATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER
orCATCH_CONFIG_ENABLE_ALL_STRINGMAKERS
.Also includes configuration macros for detecting C++17 and header presence, so it doesn't break the build for anyone on C++ < 17 who's using
CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS
.Tests are modelled after the tuple tests.