https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98682
Bug ID: 98682 Summary: g++ allows goto inside statement expr Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nbkolchin at gmail dot com Target Milestone: --- The following obviously incorrect program compiles without error under g++: #include <stdio.h> int main(int argc, char** argv) { goto L_bug; printf("%s, %s %s\n", "Hello", ({ L_bug: ; "world!";}), "What?"); } gcc produces error: "error: jump into statement expression". Tested under gcc versions: 6.3.0, 7.5.0, 10.2.0. This behaviour contradicts with documentation: "Jumping into a statement expression with goto or using a switch statement outside the statement expression with a case or default label inside the statement expression is not permitted."