Issue |
138257
|
Summary |
Statement expressions allow jumping past initialization
|
Labels |
new issue
|
Assignees |
|
Reporter |
AaronBallman
|
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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs