[Bug c++/28031] [4.2 regression] bogus jump to case label crosses initialization error with C99 anonymous initializers

mmitchel at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Oct 2 14:32:00 GMT 2008



------- 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



More information about the Gcc-bugs mailing list