aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog5
-rw-r--r--libgomp/testsuite/libgomp.c++/pr58706.C47
2 files changed, 52 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 70e765e..ae5f28f 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2016-08-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/58706
+ * testsuite/libgomp.c++/pr58706.C: New test.
+
2016-08-04 Thomas Schwinge <thomas@codesourcery.com>
* testsuite/libgomp.oacc-c++/routine-1-auto.C: New file.
diff --git a/libgomp/testsuite/libgomp.c++/pr58706.C b/libgomp/testsuite/libgomp.c++/pr58706.C
new file mode 100644
index 0000000..3d8ea89
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c++/pr58706.C
@@ -0,0 +1,47 @@
+// PR c++/58706
+// { dg-do run }
+// { dg-options "-std=c++11" }
+
+template <typename T>
+T
+foo ()
+{
+ T n = T ();
+#pragma omp parallel for reduction (+: n)
+ for (T i = [](){ return 3; }(); i < 10; ++i)
+ n++;
+ return n;
+}
+
+template <typename T>
+T
+bar ()
+{
+ T n = T ();
+#pragma omp parallel for reduction (+: n)
+ for (T i = [](){ return 1; }() + [](){ return 4; }(); i < 10; ++i)
+ n++;
+ return n;
+}
+
+template <typename T>
+T
+baz ()
+{
+ T n = T ();
+#pragma omp parallel for reduction (+: n)
+ for (T i = T (); i < [](){ return 7; }() + [](){ return 11; }(); i += [](){ return 3; }() - [](){ return 1; }())
+ n++;
+ return n;
+}
+
+int
+main ()
+{
+ if (foo <int> () != 7 || foo <long long> () != 7)
+ __builtin_abort ();
+ if (bar <int> () != 5 || bar <char> () != 5)
+ __builtin_abort ();
+ if (baz <int> () != 9 || baz <long long> () != 9)
+ __builtin_abort ();
+}