From f779aeb8af7def1bb21eade301d546fe0297d9e6 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 6 Oct 2016 00:25:29 +0000 Subject: [PATCH] * g++.dg/cpp1z/init-statement9.C: New test. From-SVN: r240824 --- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp1z/init-statement9.C | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1z/init-statement9.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a0659f2a513..1f55a336708 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-10-06 Marek Polacek + + * g++.dg/cpp1z/init-statement9.C: New test. + 2016-10-05 Andrew Senkevich * gcc.target/i386/pcommit-1.c: Deleted. diff --git a/gcc/testsuite/g++.dg/cpp1z/init-statement9.C b/gcc/testsuite/g++.dg/cpp1z/init-statement9.C new file mode 100644 index 00000000000..5425f973be8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/init-statement9.C @@ -0,0 +1,17 @@ +// { dg-options -std=c++1z } + +void +f () +{ + { + int c; + if (int c = 2; c != 0) + int c = 4; // { dg-error "redeclaration" } + } + + if (int c = 2; c != 0) + int c = 4; // { dg-error "redeclaration" } + + if (int c = 2; int c = 6) // { dg-error "redeclaration" } + int c = 4; // { dg-error "redeclaration" } +} -- 2.30.2