Open
Description
In C++, both Clang and GCC diagnose when a jump statement will jump over an initialization. However, statement expressions seem to be allowed to do so:
void f(void) {
for (int i=({ goto ouch; int x = 10; x;});i<0;++i)
ouch:
;
}
void g(void) {
({
goto ouch;
int i = 12;
});
ouch:
;
}
https://godbolt.org/z/Eda59KqPT
It's possible that this is intentional given that statement expressions tend to be hidden behind macros, but this seems inconsistent and somewhat dangerous to allow.