-
Notifications
You must be signed in to change notification settings - Fork 273
C++2a <=>
operator breaks the build
#1974
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
I'm wondering whether this some kind of bug in the way Clang generates those warnings? I'd be curious whether it does the same for #include <cstring>
#include <cassert>
#define op <=>
const char *s = #op;
const char *s2 = "<=>";
int main(int argc, char *argv[])
{
assert(strcmp(s, s2) == 0);
return 0;
} ? I'd suggest to add a pragma to override this, possibly just for Clang - take a look at various util/pragma*. |
Line 4 is |
Brilliant, thanks! |
BTW should I copy you in? If not, I can just post a summary over here when I've heard back from clang developers. |
Happy to be copied in, but also please do post a summary here or a link to the thread if there is a public archive (I suppose so). |
@karkhaz what happens if you use |
I believe @tautschnig's example is slightly wrong, I don't think you can use the
The preprocessed output of that is
|
Ah, nonsense. Sorry, here's the correct version:
Preprocessed:
Clang complains both when I preprocess it with Sorry for the confusion. |
Why is it that the |
Because |
So maybe that's ok, because we have |
Not sure what you want me to check? I believe |
Ok, thanks, then we're good. Let's see what the Clang people say. |
Cool! I don't think this is super-urgent, which is good because most of the Clang developers are probably still sleeping 🙂 The mail that I sent to the list needs to be moderated, not sure how long that will take. In theory this issue only affects users of Arch Linux, Gentoo, etc., and also people who compile Clang from source. Even then, switching off the warning should be fine until the Clang people clarify. |
Duncan Exon Smith confirms that this is likely a bug. I need to open a bugzilla account to file for this, but I'll update this thread if anything interesting happens. https://lists.llvm.org/pipermail/cfe-dev/2018-March/057396.html |
Filed a bug here: https://bugs.llvm.org/show_bug.cgi?id=36925 |
@karkhaz worth pinging them? |
clang++-6.0 warns that in the next C++ standard <=> will be an operator and therefore an atomic lexical token. I think that's overly zealous, but it's easily worked around by explicitly quoting the name, which will be stringified before use in any case. See diffblue#1974 for more details, or https://bugs.llvm.org/show_bug.cgi?id=36925 for an upstream bug report.
@smowton I'm going to ask for advice on IRC about fixing this. Basically the warning is being emitted from here, i.e. in the lexer. IMO, this is too early to decide whether the warning should be emitted, as you need some context to decide whether the use of Anyway, I will ask for advice on IRC tonight, and if I get nothing satisfactory, I'll ping the bug report. |
@smowton however, if your commit fixes that problem, then I would recommend opening a PR for it---even if the Clang bug is fixed fairly soon, I'm not sure how quickly it would propagate to the distro versions of Clang. It would suck if Ubuntu or whatever started using Clang 6.0 and broke a lot of people's builds, it would be nice to preempt that. |
One last build failure when using a recent compiler (Clang 6.0 with experimental C++2a support):
<=>
is the "spaceship operator" that might be introduced in C++ at some point. This is a bit weird because the<=>
is supposed to be stringified by the macro, but Clang still sees it for some reason. Anyhow, I haven't patched this in #1973, but it can be suppressed for now by building with-Wno-c++2a-compat
.The text was updated successfully, but these errors were encountered: