[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 10:22:00 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93589
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Lokesh Janghel from comment #2)
> I reduce the test case for non-template:
> #define CHAR_BIT 8
> void print_byte_order( short )
> {
> short val = 0;
> unsigned i = 1;
> val |= (CHAR_BIT * static_cast<short>(i)) << (CHAR_BIT *
> static_cast<short>(i));
> }
>
> That gives warning in GCC but Clang not.
Right and GCC is correct here.
The promotion rules of multiply and shift is to int from short.
More information about the Gcc-bugs
mailing list