-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
FMT_ATTACH_TO_GLOBAL_MODULE does not compile with clang #4081
Comments
Thanks for reporting. It seems that the second issue has an easy workaround of adding |
Comments without studying the code or its changes in detail:
must work then because of [basic.def.odr]/15 Unfortunately, Clang 18 is still getting this wrong. To its excuse, it doesn't claim conformance to the standard. |
Happy to provide a PR if this looks like what is needed. It does appear to fix it, I'm just not familiar enough with the standard and modules to be certain that
I spent quite a bit of time looking this stuff up before posting the issues. Perhaps my interpretation of the standard is off, that's why I needed some input/confirmation. From [dcl.constexpr]:
And from [basic.link]:
To me this says that
Yep, I'm aware it changes the attachment, but I don't follow how this relates to the question of linkage. One option I believe would be to change the variable to be |
PRs submitted for each change. With these two combined I can now build |
You were speaking about This is from my tests in a different project where I check the coexistence of
|
Correct. As mentioned above, trying this with fmt (with the changes from the PRs) fails on both MSVC and clang, with endless redefinition errors. Merely
is sufficient to break it on both compilers. So it seems there is some way to go before this can be used fully in a way that permits diamond dependency graphs within a TU without worrying about a shared dependency being consumed as both modules and includes. Even so, it still has value now I think, because it permits linking together TUs that consumed fmt in different ways. |
There appear to be two independent issues:
os.h:386:16: error: declaration of 'buffer_size' with internal linkage cannot be exported
.constexpr
implying internal linkage has an exception for module interface units, but it seems when enclosed withinextern "C++"
clang ceases to apply this exception. I suspect clang is probably wrong here and fmt/MSVC are correct, but not 100% sure. I filed an issue with LLVM.error: declaration of 'assert_fail' in module fmt follows declaration in the global module
. This one I suspect is more likely to be clang being correct and fmt/MSVC wrong to permit it, but again unsure. clang seems to want the definitions of things previously declared withinextern "C++"
to also be within such a block.So it's possible there is no error here on fmt's side, but from experience, with two discrepancies between MSVC and clang, MSVC being on the correct side of both is unlikely!
The text was updated successfully, but these errors were encountered: