diff options
Diffstat (limited to 'libgomp/testsuite/libgomp.c++/loop-7.C')
-rw-r--r-- | libgomp/testsuite/libgomp.c++/loop-7.C | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c++/loop-7.C b/libgomp/testsuite/libgomp.c++/loop-7.C new file mode 100644 index 000000000..4eccb7fca --- /dev/null +++ b/libgomp/testsuite/libgomp.c++/loop-7.C @@ -0,0 +1,22 @@ +// PR c++/24502 +// { dg-do run } + +extern "C" void abort (); + +template <typename T> T +foo (T r) +{ + T i; +#pragma omp for + for (i = 0; i < 10; i++) + r += i; + return r; +} + +int +main () +{ + if (foo (0) != 10 * 9 / 2 || foo (2L) != 10L * 9 / 2 + 2) + abort (); + return 0; +} |