<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/128939>128939</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] P2588R2 not implemented, despite claim to contrary on cxx_status.html
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
zygoloid
</td>
</tr>
</table>
<pre>
Clang appears to have not implemented P2588R2, despite claiming to have done so.
This example is mishandled:
```c++
#define FOO$ 10
#define STR(x) #x
#define STR2(x) STR(x)
const char *p = STR2(FOO$)
```
This is valid under P2588R2, and `p` should be initialized to the string `$ 10$`:
- The first line defines a macro named `FOO` whose expansion is `$ 10`.
- The `STR2(FOO$)` macro expansion's argument expands to `$ 10$`.
- Therefore the result of stringization should be `"$ 10$"`.
Under [lex.pptoken], adding `$` et al to the basic source character set means that when `$` appears in a source file (outside of a string or character literal), it always forms a single-character *preprocessing-token*. Ultimately, the issue here is that the [GNU "dollars in identifiers" extension](https://gcc.gnu.org/onlinedocs/gcc/Dollar-Signs.html) is a non-conforming extension post-P2588R2, so presumably we should stop enabling it by default in our conforming mode. Maybe it should only be enabled in `-std=gnu++2c`, not in `-std=c++2c`?
Also, the handling of
```c++
#define STR(x) #x
#define STR2(x) STR(x)
const char *p = STR2(\u0024);
```
is incorrect. This is accepted in all C++ language modes prior to Clang 17, and rejected in all C++ language modes in Clang 17 onwards. Both behaviors are wrong: it should be accepted in C++23 and earlier, and rejected in C++2c, because `$` is part of the basic source character set only in C++2c onwards. (Even if this were correct, [cxx_status.html](https://clang.llvm.org/cxx_status.html) should say this paper is implemented in Clang 17, not simply "Yes".)
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJysVk_v4jYQ_TTmMiIyDuEHBw78KT21W-2fQ0-VYw-Jt44d2c4P2E9fTUIgy660l0qRQLHned6bmRfLGE3lELes2LPiOJNdqn3YfrtV3n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