Compiling the following snippet as C or C++ < C++14: #if 0 unsigned int test (void) { return 0b0101'0101'0101'0101'0101'0101'0101'0101; } #endif results in the following warning: warning: missing terminating ' character return 0b0101'0101'0101'0101'0101'0101'0101'0101; ^ Putting the code in a block comment makes the warning go away. I'm not sure how to categorize this or whether this is intended. It looks strange though.
This is correct tokenization has to happen in #if code. *** This bug has been marked as a duplicate of bug 11806 ***
(In reply to Andrew Pinski from comment #1) > This is correct tokenization has to happen in #if code. But in C++14 tokenization should handle digit separators, see the definition of pp-number in 2.9 [lex.ppnumber], which allows single quotes in a pp-number.
(In reply to Jonathan Wakely from comment #2) > But in C++14 tokenization should handle digit separators, see the definition > of pp-number in 2.9 [lex.ppnumber], which allows single quotes in a > pp-number. Right it does not warn for C++14 and above so there is no bug and even was mention in the original comment: C or C++ < C++14
*** Bug 101628 has been marked as a duplicate of this bug. ***
Similar issue as PR 11064.
What's really fun is that you can't even do: #if __cpp_digit_separators int i = 1'000; #else int i = 1000; #endif
I think it is PR14634 that actually changed this. The question is if we can avoid the pedwarn in system headers, or if it should be kind of pedwarn that isn't emitted as a warning without -pedantic/-Wpedantic.