Clang incorrectly rejects identifier using UCN identifier
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
**What code / commands /steps will reproduce the problem?**
Compile the below sample code:
```cpp
int \u0D3F;
int main() {
return \U00000D3f;
}
```
Compiler Explorer link: https://godbolt.org/z/8Pbh1GGEW
What is the expected result?
Compilation should be successful.
As per the standard, identifiers may contain universal-character-names that designate characters allowed by ISO/IEC TR 10176.
What happens instead?
g++ (GCC) compilation is successful.
Clang compilation fails with:
```console
:1:5: error: expected unqualified-id
1 | int \u0D3F;
| ^
:4:12: error: expected expression
4 | return \U00000D3f;
| ^
2 errors generated.
Compiler returned: 1
```
This identifier should be accepted; Clang’s rejection appears non-conforming.
Contributor guide
Assessment
This issue has not been assessed yet.