* g++.dg/cpp1z/init-statement9.C: New test.
authorMarek Polacek <polacek@redhat.com>
Thu, 6 Oct 2016 00:25:29 +0000 (00:25 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 6 Oct 2016 00:25:29 +0000 (00:25 +0000)
From-SVN: r240824

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1z/init-statement9.C [new file with mode: 0644]

index a0659f2a51301dbc8d96d4f8349809b7f61f73cc..1f55a336708ff9e736d37e44cbd02b42eae3f08c 100644 (file)
@@ -1,3 +1,7 @@
+2016-10-06  Marek Polacek  <polacek@redhat.com>
+
+       * g++.dg/cpp1z/init-statement9.C: New test.
+
 2016-10-05  Andrew Senkevich  <andrew.senkevich@intel.com>
 
        * 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 (file)
index 0000000..5425f97
--- /dev/null
@@ -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" }
+}