llvm / llvm/llvm-project

Preprocessing numbers with dollar signs after digit separators should be accepted

Open
#209,516 2 comments 0 reactions 0 assignees View on GitHub
c23 clang:frontend
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Duplicate of the second half of #171190 since that was closed without fixing it:
```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, [Issue 1082](https://www.open-std.org/jtc1/sc22/wg14/issues/c23/issue1082.html)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the provided C23 example and compare its preprocessing behavior with MSVC and GCC. Trace LLVM's preprocessing rules for pp-number, digit separators, and nondigit handling, using the cited C23 issue as the language reference. Done means the example is accepted consistently with the specified dollar-sign rule and has coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.