-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Does not work in C++23 due to conflicts with import std cxx modules #2969
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
Comments
Seeing as that I certainly want to support those who use Perhaps I'm overestimating how much would have to change to implement this but I'm picturing having to add and maintain that |
AIUI, you should be fine as long as you include catch2 and then import std, because
works on major implementation (because this is the order that can be made to work with workarounds inside the stdlib). |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
In past discussions, Catch2 devs explained that it's not possible to migrate the project for CXX Modules, because modules cannot export macros, which is correct (#2299). However, even if the user has cxx modules in its code, specially C++23 import std, then it cannot currently interoperate with header only catch2, because it imposes its #include , generating ODR with import std, if compiler is not "smart enough" (which is currently the case and maybe will never be fully solved).
My problem now is that I'm a long time Catch2 user, and I cannot make it work with Clang 19 or GCC 15, because I'm using
import std
on C++23 and that's incompatible with current Catch2 design (but it's easy to solve!).Expected behavior
Catch2 should provide some way to disable its #include for STD things, for example, adding an option or macro like "CATCH2_DISABLE_STD_INCLUDE"... so , all #include should be surrounded by this option:
Macro name can also be
CATCH_USE_STDLIB_MODULE
, as in, #2575, but I don't know if Catch2 is interested in really using import std... maybe not! But this proposal here is simpler, it just allows users to choose between its ownimport std
or the current Catch2 #include dependencies.Reproduction steps
Create some Module.cpp file, with import std, and try to #include catch2, or try to link against it. ODR violations will be reported.
Platform information:
Additional context
If necessary, I can do the PR... specially, for the amalgamated hpp file, it would be nice to disable all its header inclusions.
The text was updated successfully, but these errors were encountered: