Skip to content

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

Closed
@tahonermann

Description

@tahonermann

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.

Metadata

Metadata

Assignees

Labels

clang:driver'clang' and 'clang++' user-facing binaries. Not 'clang-cl'confirmedVerified by a second party

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions