summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/init/for2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/init/for2.C')
-rw-r--r--gcc/testsuite/g++.dg/init/for2.C13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/init/for2.C b/gcc/testsuite/g++.dg/init/for2.C
new file mode 100644
index 000000000..d66fea30e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/init/for2.C
@@ -0,0 +1,13 @@
+// { dg-do compile }
+// PR 16012: Got the scope of I incorrect in templates only.
+
+template<int> void foo()
+{
+ for (int i=0 ;;) ;
+ int i;
+}
+
+void bar()
+{
+ foo<0>();
+}