https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83107
Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |marxin at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- > I think it is a bug because, for example, (unsigned long int)1<<32 is just a > recast of the result of 1<<32. > 1 is an int, so 1<<32 is also an int with the value 0, which is eventually > recast into an unsigned long int. > So -Wshift-count-overflow should report the count overflow. It's not bug because the expression is equivalent to: auto val2 = ((unsigned long int)1)<<32; Which is correct. You are talking about: pr83107.cpp:5:37: warning: left shift count >= width of type [-Wshift-count-overflow] auto val3 = (unsigned long int)(1<<32);