| Issue |
164220
|
| Summary |
-Wcharacter-conversion warns about explicit cast with {}
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
marcmutz
|
I don't think this is intended:
```
void fun(char32_t);
const char16_t c16 = ~~~'
fun(c16); // warning: implicit conversion from 'const char16_t' to 'char32_t' may change the meaning of the represented code unit (OK)
fun(char32_t{c16}); // SAME warning (incl. "implicit conversion")
```
I explicitly convert, why is it still complaining?
This particular warning was, of course, removed by #163927, but I guess the same still applies for, say, char8_t -> char32_t.
Using parentheses instead of braces fixes the issue, but I'd like to use braces for their static narrowing prevention.
Another thing I noted is that the warning, for the same code, isn't emitted if I make the function containing it `constexpr`.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs