| Issue |
171190
|
| Summary |
Preprocessing numbers with dollar signs are rejected when they are accepted in identifiers
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Halalaluyafail3
|
The following program demonstrates the issue:
```c
#define CAT(X,Y,Z)CAT_(X,Y##Z)
#define CAT_(X,Y)X##Y
int main(){
int CAT(X,0,$);
}
```
Clang rejects this because it believes `0$` is not a valid preprocessing token. GCC and MSVC accept this code. Considering that the definition of pp-number references identifier-continue, I don't see any reason that this code should be rejected.
This also applies after a digit separator:
```c
#define STR(X)#X
int main(){
STR(0'$);
}
```
C23 defines the optional support for dollar signs in identifiers by allowing nondigits to include dollar signs. So the reference to nondigit in pp-number should also allow a dollar sign after a digit separator. MSVC accepts this, GCC doesn't. See also: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123057>
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs