-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Open
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partydiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue
Description
The following program demonstrates the issue:
#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:
#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
Metadata
Metadata
Assignees
Labels
clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partyVerified by a second partydiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issue