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.