Message ID | 20190921140236.GW14737@redhat.com |
---|---|
State | New |
Headers | show |
Series | C++ PATCH to add test for DR 2345 | expand |
diff --git gcc/testsuite/g++.dg/cpp1z/init-statement10.C gcc/testsuite/g++.dg/cpp1z/init-statement10.C new file mode 100644 index 00000000000..d13d135dab1 --- /dev/null +++ gcc/testsuite/g++.dg/cpp1z/init-statement10.C @@ -0,0 +1,14 @@ +// DR 2345 - Jumping across initializers in init-statements and conditions. +// { dg-do compile { target c++17 } } + +int +fn () +{ + goto X; + if (int i = 42; i == 42) + { +X: // { dg-error "jump to label" } + return i; + } + return -1; +}