This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]