-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Clang 18 rejects operator"" _a
#3607
Comments
Clang 18 warns about this whitespace. Resolves fmtlib#3607
Clang 18 warns about this whitespace. Resolves fmtlib#3607
Could you provide a godbolt repro? |
It's trivial to make a repro of the warning outside of fmtlib but I am having trouble getting format.h to create that UDL I guess and I am not sure why. https://godbolt.org/z/WbaoTT9KP Here's a CI run where I found the warning trip: https://github.com/chromium/subspace/actions/runs/5947977722/job/16130912813?pr=330 It will only occur when Lines 4425 to 4434 in 0bffed8
You would think Lines 234 to 243 in 0bffed8
I am compiling with C++20 enabled, I am not sure what is different on Github CI vs Godbolt. Any ideas? |
godbolt might be hiding warnings from the library but your repro is good enough. Unfortunately per discussion on the PR gcc requires a space there so I'm not sure we can do anything about it. |
I guess one options would be to only enable UDLs on gcc 4.9 or higher in Line 155 in 0bffed8
|
I am building clang trunk on my mac to see if I can reproduce there, and if so, explain why or if |
No luck, clang ToT on Mac is not hitting the warning. |
I did some testing in CI: https://github.com/chromium/subspace/actions/runs/5957000756/job/16158898370?pr=330 #if defined(__cpp_nontype_template_args)
#warning __cpp_nontype_template_args
#endif
#if FMT_GCC_VERSION >= 903
#warning FMT_GCC_VERSION >= 903
#endif
#if FMT_CPLUSPLUS >= 201709L
#warning FMT_CPLUSPLUS >= 201709L
#endif
#if __cpp_nontype_template_args >= 201911L
#warning __cpp_nontype_template_args >= 201911L
#endif
#if defined(__NVCOMPILER)
#warning __NVCOMPILER
#endif
#if defined(__LCC__)
#warning __LCC__
#endif Prints
Meaning __cpp_nontype_template_args is defined but is not >= 201911L which is why it's going into the other path there. |
I guess because it is not done. llvm/llvm-project#54297 (comment) So they started warning on the operator"" syntax but the branch choices made in fmtlib then clash with gcc. Even though I think it is implemented enough for fmtlib's use anyway. I wonder if maybe hardcoding clang >= 16 or something to go the path without the warning? |
I got wondering if
|
In LLVM:
After that revert by @rnk my CI is green with clang 18, I guess I had unlucky timing there. Not sure if you want to make fmtlib confirming by removing the whitespace - it seems like a good idea to do still to me but I can understand otherwise. |
The fix is to change
operator"" _a
tooperator""_a
The text was updated successfully, but these errors were encountered: