https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77846
Bug ID: 77846 Summary: Wrong error recovery with switch, goto and initialization skipped Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: denis.campredon at gmail dot com Target Milestone: --- Compiling the following code with -Wswitch ------------------- enum E {A, B}; class C {public: C();}; void f(E e) { goto out; switch (e) { case A: C c; case B:; } out:{} } ------------------- main.cpp: In function 'void f(E)': main.cpp:9:14: error: jump to case label [-fpermissive] case B:; ^ main.cpp:8:11: note: crosses initialization of 'C c' C c; ^ main.cpp:6:12: warning: enumeration value 'B' not handled in switch [-Wswitch] switch (e) { ^ ---------------- The warning main.cpp:6:12: warning: enumeration value 'B' not handled in switch [-Wswitch] Is wrong since B is handled in the switch. Also it would be nice if the line of the goto and the line of the label were shown in the output, something like: Jumping from `goto' to `label' crosses the initialization of 'c, d, ...