Open
Description
After P2621R2, which is a defect report, the following program is ill-formed in C++ (UB beforehand):
#define X '\N'
int main() {}
This is ill-formed already in translation phase 3 when lexing into preprocessing tokens, because \N
not followed by {
can't be a named-universal-character and \N
also can't begin any escape-sequence. Therefore '\N'
can't be a character-literal and '
will form a single-character preprocessing token by itself. [lex.pptoken]/2 makes this ill-formed (UB before P2621R2).
The C++ status page claims that P2621R2 is already supported, but Clang compiles this without diagnostic (https://godbolt.org/z/WxvcfPj8a).
The same happens with other invalid escape sequences and string literals as well.