aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-12-01 15:27:12 +0000
committerJakub Jelinek <jakub@redhat.com>2008-12-01 15:27:12 +0000
commit9977836b41ecb9c5ad4e496557e3066b3acaf2b0 (patch)
treeecc36046a609da5f002a051ee7dfcc4183fc8c30 /libgomp
parent6904cfadf86710881e41f041b0a79c049f8b8b69 (diff)
PR c++/38257
* parser.c (cp_parser_omp_for_loop): Handle auto. * pt.c (tsubst_omp_for_iterator): Likewise. * testsuite/libgomp.c++/for-7.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@142320 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog3
-rw-r--r--libgomp/testsuite/libgomp.c++/for-7.C110
2 files changed, 113 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 5576af2049c..89c8a42dd41 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,8 @@
2008-12-01 Jakub Jelinek <jakub@redhat.com>
+ PR c++/38257
+ * testsuite/libgomp.c++/for-7.C: New test.
+
PR c++/38348
* testsuite/libgomp.c++/for-6.C: New test.
diff --git a/libgomp/testsuite/libgomp.c++/for-7.C b/libgomp/testsuite/libgomp.c++/for-7.C
new file mode 100644
index 00000000000..9d626c028df
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/for-7.C
@@ -0,0 +1,110 @@
+// PR c++/
+// { dg-do run }
+// { dg-options "-std=c++0x -fopenmp" }
+
+extern "C" void abort ();
+int cnt;
+
+template <typename T>
+void
+f0 (T, int)
+{
+ abort ();
+}
+
+template <>
+void
+f0<int> (int, int type)
+{
+ if (type != 0)
+ abort ();
+#pragma omp atomic
+ cnt++;
+}
+
+template <>
+void
+f0<const char *> (const char *, int type)
+{
+ if (type != 1)
+ abort ();
+#pragma omp atomic
+ cnt++;
+}
+
+template <typename T>
+void
+f1 ()
+{
+#pragma omp parallel for
+ for (auto i = 0; i < 10; i++)
+ f0 (i, 0);
+}
+
+template <typename T>
+void
+f2 ()
+{
+#pragma omp parallel for
+ for (auto i = T (0); i < T (10); i += T (1))
+ f0 (i, 0);
+}
+
+void
+f3 ()
+{
+#pragma omp parallel for
+ for (auto i = 0; i < 10; i++)
+ f0 (i, 0);
+}
+
+const char *p = "abcdefghij";
+
+template <typename T>
+void
+f4 ()
+{
+#pragma omp parallel for
+ for (auto i = p; i < p + 10; i++)
+ f0 (i, 1);
+}
+
+template <typename T>
+void
+f5 ()
+{
+#pragma omp parallel for
+ for (auto i = T (p); i < T (p + 10); i++)
+ f0 (i, 1);
+}
+
+void
+f6 ()
+{
+#pragma omp parallel for
+ for (auto i = p; i < p + 10; i++)
+ f0 (i, 1);
+}
+
+int
+main ()
+{
+ f1<int> ();
+ if (cnt != 10)
+ abort ();
+ f2<int> ();
+ if (cnt != 20)
+ abort ();
+ f3 ();
+ if (cnt != 30)
+ abort ();
+ f4<int> ();
+ if (cnt != 40)
+ abort ();
+ f5<const char *> ();
+ if (cnt != 50)
+ abort ();
+ f6 ();
+ if (cnt != 60)
+ abort ();
+}