Disallow the -fchar8_t and -fno-char8_t options for C modes · Issue #55373 · llvm/llvm-project (original) (raw)

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.