<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107191>107191</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Invalid character literal accepted in C++ during preprocessing after P2621R2.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
keinflue
</td>
</tr>
</table>
<pre>
After [P2621R2](https://github.com/cplusplus/draft/commit/47dbc585f6297f03518e81bfe59d4b414ac64fb2), 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 2 when lexing into preprocessing tokens, because `\N` not followed by `{` can't be a _named-universal-character_ an `\N` can also not 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 Clang compiles this without diagnostic (https://godbolt.org/z/WxvcfPj8a).
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8lEFv6zYMxz-NciFi2Iwd2wcfmhYBdhkehjdst4KWaFuvsuRJctPu0w9yk9cWrxiQ2Ilpkn-SP5FC0KNl7kR1EtXDjtY4Od89sbaDWXnXO_Xa3Q2RPYjq9A2PWPyBonoQ2EwxLkEc7gSeBZ5HHae1z6SbBZ7lYtaQvgLPytMQ0zM3zzr9KGvVy6qphiO29ZAfqqLhpugHrlpV9mVRkjyWQ48CW4H3cJm0nEAHIFA8sIzgeXE-JlucGAZnjLtoO8Li3ehpTu9qY_aD8zMr0BbuBZ4EnkBg8-cJeh6c54msShkOdyJ_EPntesyvn7e_eFA8aMvwNwisRXX_e7ptNm0jzKStwEZgC6I-ifrh6yjb9fuUdH2SRsYzqdckMXqywVDUzsIyUWBAuExswfBLqk3b6GDxvHgnOY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