diff options
author | Marek Polacek <polacek@redhat.com> | 2019-09-21 13:59:29 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-09-21 13:59:29 +0000 |
commit | 296580b640a8161ae25037b01cc4f8e45bc73a30 (patch) | |
tree | c153a90980dc1bb7c8ce87b9a5c952cbdfecd3d7 /gcc | |
parent | 9f635bd13fe9e85872e441b6f3618947f989909a (diff) | |
download | gcc-296580b640a8161ae25037b01cc4f8e45bc73a30.zip gcc-296580b640a8161ae25037b01cc4f8e45bc73a30.tar.gz gcc-296580b640a8161ae25037b01cc4f8e45bc73a30.tar.bz2 |
DR 2345 - Jumping across initializers in init-statements and conditions.
* g++.dg/cpp1z/init-statement10.C: New test.
From-SVN: r276019
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1z/init-statement10.C | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d0c01e3..36e0b2b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-21 Marek Polacek <polacek@redhat.com> + + DR 2345 - Jumping across initializers in init-statements and conditions. + * g++.dg/cpp1z/init-statement10.C: New test. + 2019-09-21 Richard Sandiford <richard.sandiford@arm.com> * gcc.target/aarch64/sve/cond_convert_1.c: Remove XFAILs. diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement10.C b/gcc/testsuite/g++.dg/cpp1z/init-statement10.C new file mode 100644 index 0000000..d13d135 --- /dev/null +++ b/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; +} |