[Bug c++/55137] [4.8 Regression] Unexpected static structure initialization

sebastian.huber@embedded-brains.de gcc-bugzilla@gcc.gnu.org
Tue Nov 6 15:35:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55137

--- Comment #5 from Sebastian Huber <sebastian.huber@embedded-brains.de> 2012-11-06 15:34:57 UTC ---
(In reply to comment #3)
> enum E { E1 = -1 + (int) (sizeof (int) - 1) };
> errors while it used to be accepted before.
> Dunno if that is valid or not.
> If it is valid, the series of foldings that result into the overflow are first
> folding sizeof (int) - 1UL into sizeof (int) + 18446744073709551615UL and later
> on conversion of -1 + (int) (sizeof (int) + 18446744073709551615UL) to
> -1 + (int) sizeof (int) + (int) 18446744073709551615UL.

Why is the ( ) ignored?  The sizeof (int) - 1 is clearly an unsigned integer
which can be converted to a signed integer.



More information about the Gcc-bugs mailing list