-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fix __cplusplus macro for Visual Studio #237
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #237 +/- ##
==========================================
- Coverage 97.00% 96.96% -0.05%
==========================================
Files 131 126 -5
Lines 4171 4115 -56
==========================================
- Hits 4046 3990 -56
Misses 125 125 ☔ View full report in Codecov by Sentry. |
The build failures here are caused not by Catch2 this time, but a similar issue with GTest. Conan is pulling down packaged build with C++14 from the Conan Index Centre resulting in this issue: google/googletest#3081 |
Issue identified in Conan Gtest package: conan-io/conan-center-index#22547 A fix should be able to soon go into Conan 2.1 |
It turns out this does not fix the issues which is actually affecting Windows, which is that Conan does see any binary compatibility between the C++17 and C++20 versions which there is. This is a know issue for Conan, and requires a fix is committed to the GTest recipe and is the same issue affecting Catch2 currently: #241 |
I've now sepperated the updating the GTest package sync to rely on pre-built packages to a separate PR so the fix to Visual Studio C++ flag can go in now: #291 |
So it turns out that Visual Studio has been incorrectly defining the __cplusplus macro all along, and so checks which depend on this, just as memory resource tests, are incorrectly not executed on Windows.
This is described in the following:
https://stackoverflow.com/a/56483887/4764531
https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
The compiler option /Zc:__cplusplus ensures Visual Studio update the value of this macro.