The n-char grammar term is defined to match only the Latin uppercase, Latin digit, hyphen and space characters. This results in \N{ABC} matching named-universal-character while \N{abc} does not. This leads to programs like the following being unexpectedly well-formed because the \N{abc} sequence is lexed as the preprocessing token sequence \, N, {, abc, }. The expansion of macro a then leads to the token sequence being passed as an argument to macro z where it is discarded.
#define z(x) 0
#define a z(
int x = a\N{abc});
Changes to make the above program ill-formed would provide two benefits:
Implementations could diagnose the \N{abc} sequence as an ill-formed named-universal-character regardless of where it appears in a program.
The \N{…} syntax space would be reserved for expansion (e.g., for extensions or future support of UAX44-LM2 loose matching schemes).
Proposed change:
Change the definition of n-char to match the lexing behavior of other delimited character sequences like basic-c-char for character literals and basic-s-char, r-char, and d-char for string literals.
n-char:
any member of the translation character set except the U+007D RIGHT CURLY BRACKET or new-line character
The n-char grammar term is defined to match only the Latin uppercase, Latin digit, hyphen and space characters. This results in \N{ABC} matching named-universal-character while \N{abc} does not. This leads to programs like the following being unexpectedly well-formed because the \N{abc} sequence is lexed as the preprocessing token sequence \, N, {, abc, }. The expansion of macro a then leads to the token sequence being passed as an argument to macro z where it is discarded.
Changes to make the above program ill-formed would provide two benefits:
Proposed change: Change the definition of n-char to match the lexing behavior of other delimited character sequences like basic-c-char for character literals and basic-s-char, r-char, and d-char for string literals. n-char: any member of the translation character set except the U+007D RIGHT CURLY BRACKET or new-line character