Skip to content

Disallow the -fchar8_t and -fno-char8_t options for C modes #55373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tahonermann opened this issue May 10, 2022 · 1 comment · Fixed by #138716
Closed

Disallow the -fchar8_t and -fno-char8_t options for C modes #55373

tahonermann opened this issue May 10, 2022 · 1 comment · Fixed by #138716
Assignees
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' confirmed Verified by a second party

Comments

@tahonermann
Copy link
Contributor

tahonermann commented May 10, 2022

Clang 15 trunk currently allows the -fchar8_t and -fno-char8_t options to be specified when compiling in C modes and the former has the effect of causing char8_t to be both a keyword and a type specifier. This behavior is not desirable; in C23, char8_t is a typedef of unsigned char declared in uchar.h. See N2653 for details.

$ cat t.c
char8_t c8;

$ clang --version
clang version 15.0.0 (https://github.com/tahonermann/llvm-project.git 5531abaf7158652bf7411937781780e9f6358ecf)
...

$ clang -c t.c
t.c:1:1: error: unknown type name 'char8_t'
char8_t c8;
^
1 error generated.

$ clang -c -fchar8_t t.c
<no error, but we want one!>

This issue will track changing Clang to reject the -fchar8_t and -fno-char8_t options in C modes or to ignore them with an appropriate diagnostic.

@EugeneZelenko EugeneZelenko added clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' and removed new issue labels May 10, 2022
@llvmbot
Copy link
Member

llvmbot commented May 10, 2022

@llvm/issue-subscribers-clang-driver

@tahonermann tahonermann self-assigned this Feb 14, 2024
@AaronBallman AaronBallman added the confirmed Verified by a second party label Jul 15, 2024
cor3ntin added a commit to cor3ntin/llvm-project that referenced this issue May 6, 2025
In C, char8_t is an alias to unsigned char, and should
never be a keyword.

Fixes llvm#55373
cor3ntin added a commit that referenced this issue May 8, 2025
In C, `char8_t` is an alias to unsigned char, and should never be a
keyword.

Fixes #55373
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' confirmed Verified by a second party
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants