https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120076
Bug ID: 120076
Summary: statement expression allows bypassing own initializer
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Keywords: accepts-invalid, stmt-expr
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Examples:
```
void f(void) {
for (int i=({ goto ouch; int x = 10; x;});i<0;++i)
ouch:
;
}
void g(void) {
int i1 = ({
goto ouch;
12;
});
ouch:
;
}
```
GCC does have code to check for bypassing initializations when jumping out of a
statement expression, just it does not catch if the statement expression is
being used to initialize a variable.