Skip to content

Commit 65cf824

Browse files
committed
Add negative tests based on review feedback
1 parent c3dc933 commit 65cf824

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

clang/test/Sema/warn-jump-bypasses-init.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,19 @@ void switch_func(int i) {
2929
break;
3030
}
3131
}
32+
33+
// Statement expressions are a bit strange in that they seem to allow for
34+
// jumping past initialization without being diagnosed, even in C++. Perhaps
35+
// this should change?
36+
void f(void) {
37+
({
38+
goto ouch;
39+
int i = 12;
40+
});
41+
42+
for (int i = ({ goto ouch; int x = 10; x;}); i < 0; ++i) {
43+
}
44+
45+
ouch:
46+
;
47+
}

0 commit comments

Comments
 (0)