On Mai 09 2022, Florian Weimer via Gcc wrote:

> * Ulrich Drepper via Gcc:
>
>> t.cc: In function ‘int main()’:
>> t.cc:5:24: warning: format string is not an array of type ‘char’ [-Wformat=]
>>     5 |   printf((const char*) u8"test %d\n", 1);
>>       |                        ^~~~~~~~~~~~~
>
> This is not an aliasing violation because of the exception for char,
> right?  So the warning does not even highlight theoretical undefined
> behavior.
>
> On the other hand, that cast is still quite ugly.  All string-related
> functions in the C library currently need it.  It might obscure real
> type errors.  Isn't this a problem with char8_t?

In C++20, u8 literals have a distinct type, which is an incompatible
change from C++17.

-- 
Andreas Schwab, sch...@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

Reply via email to