Skip to content
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

Merged
merged 13 commits into from
Apr 12, 2024
Merged

Conversation

Twon
Copy link
Owner

@Twon Twon commented Nov 27, 2023

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.

Copy link

codecov bot commented Dec 3, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.96%. Comparing base (d6f7272) to head (a381d8a).
Report is 3 commits behind head on main.

❗ Current head a381d8a differs from pull request most recent head 251e704. Consider uploading reports for the commit 251e704 to get more accurate results

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.
📢 Have feedback on the report? Share it here.

@Twon
Copy link
Owner Author

Twon commented Dec 3, 2023

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

@Twon
Copy link
Owner Author

Twon commented Feb 25, 2024

Issue identified in Conan Gtest package: conan-io/conan-center-index#22547

A fix should be able to soon go into Conan 2.1

@Twon
Copy link
Owner Author

Twon commented Apr 12, 2024

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

@Twon
Copy link
Owner Author

Twon commented Apr 12, 2024

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

@Twon Twon merged commit 5c87840 into main Apr 12, 2024
19 checks passed
@Twon Twon deleted the visual_studio_cplusplus_fix branch April 12, 2024 09:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant