[Bug c++/93589] Template instantiation creates a conversion warning when it should not
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Feb 5 09:36:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I don't see the issue here due to promotion rules in C++.
Note your example code does not match the warning message you have in comment
#0.
Just add an extra cast:
static_cast<T>((CHAR_BIT * static_cast<T>(i)) << (CHAR_BIT *
static_cast<T>(i)))
Will fix the warning.
>This does not happen with CLANG.
So what two different compilers, two different choices here :).
Does clang warn even in a non-template case?
More information about the Gcc-bugs
mailing list