https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116622

            Bug ID: 116622
           Summary: Invalid character/string literals incorrectly accepted
                    in C++ during preprocessing after P2621R2.
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: keinfluegeltier at posteo dot de
  Target Milestone: ---

After P2621R2
(https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2023/p2621r2.pdf), 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
(https://eel.is/c++draft/lex#pptoken-2.sentence-4) makes this ill-formed (UB
before P2621R2).

The C++ status page claims that P2621R2 is already supported, but GCC compiles
this without diagnostic (https://godbolt.org/z/57ddY8aae).

Reply via email to