[Bug c/106929] declaration in switch-case doesn't fail since GCC 11
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106929 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek --- -std=c89 doesn't mean there aren't any extensions accepted, if you want the compiler to be pedantic, -pedantic or -pedantic-errors are the options to use as documented (the former just warns, the latter errors).
[Bug c/106929] declaration in switch-case doesn't fail since GCC 11
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106929 --- Comment #4 from Michael Zimmermann --- Interesting, but IMO it should still fail if you specify an older C standard e.g. using `-std=c89`, but currently it doesn't.
[Bug c/106929] declaration in switch-case doesn't fail since GCC 11
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106929 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #3 from Jonathan Wakely --- It's also the documented behaviour: https://gcc.gnu.org/onlinedocs/gcc-11.3.0/gcc/Mixed-Labels-and-Declarations.html and in the release notes: https://gcc.gnu.org/gcc-11/changes.html#c So not a bug.
[Bug c/106929] declaration in switch-case doesn't fail since GCC 11
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106929 --- Comment #2 from Jonathan Wakely --- For C17 (and previous standards), if you use -pedantic you'll get a warning, and -pedantic-errors will make it an error.
[Bug c/106929] declaration in switch-case doesn't fail since GCC 11
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106929 --- Comment #1 from Jonathan Wakely --- This changed with r11-4813 and is intentional: C Parser: Implement mixing of labels and code. Implement mixing of labels and code as adopted for C2X and process some std-attributes on labels.