This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28031] [4.2 regression] bogus jump to case label crosses initialization error with C99 anonymous initializers
- From: "mmitchel at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Oct 2008 14:30:22 -0000
- Subject: [Bug c++/28031] [4.2 regression] bogus jump to case label crosses initialization error with C99 anonymous initializers
- References: <bug-28031-12387@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from mmitchel at gcc dot gnu dot org 2008-10-02 14:30 -------
You're getting an error because your code is invalid for the reason the error
message states. The reason is that if the value of "i" is 1, you will end up
in the "case 1" part with "j" uninitialized. You can put the entire body of
the outer "case 0" inside braces, so that "j" is not in scope in the "case 1"
part; that will eliminate the error.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28031