This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55137] [4.8 Regression] Unexpected static structure initialization
- From: "sebastian dot huber at embedded-brains dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 06 Nov 2012 15:34:57 +0000
- Subject: [Bug c++/55137] [4.8 Regression] Unexpected static structure initialization
- Auto-submitted: auto-generated
- References: <bug-55137-4@http.gcc.gnu.org/bugzilla/>
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.