[clang] [llvm] [Clang] Fix assertion failure when passing wide string literal to __builtin_nanf (PR #205452)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 24 09:55:05 PDT 2026
================
@@ -0,0 +1 @@
+constexpr float g8 = __builtin_nanf(u8"");
----------------
AaronBallman wrote:
I think it's a bug that we don't reject this in C++ mode; `char8_t *` is a distinct type there which should not convert to `char *`. CC @cor3ntin @tahonermann for more opinions though.
I would prefer if we also diagnosed in C as well as C++. GCC accepts in C and that behavior is somewhat defensible given that `char8_t` is an alias to `unsigned char`, but I'd still like the diagnostic for the same reason Clang diagnoses this conversion in other cases: https://godbolt.org/z/z3d9ef7EE
https://github.com/llvm/llvm-project/pull/205452
More information about the cfe-commits
mailing list