From 304ac2258615e9b7335848ebef1f6a21fd92c474 Mon Sep 17 00:00:00 2001 From: jakub Date: Mon, 1 Dec 2008 15:27:12 +0000 Subject: 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: svn+ssh://gcc.gnu.org/svn/gcc/trunk@142320 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgomp/testsuite/libgomp.c++/for-7.C | 110 ++++++++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 libgomp/testsuite/libgomp.c++/for-7.C (limited to 'libgomp/testsuite/libgomp.c++') 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 +void +f0 (T, int) +{ + abort (); +} + +template <> +void +f0 (int, int type) +{ + if (type != 0) + abort (); +#pragma omp atomic + cnt++; +} + +template <> +void +f0 (const char *, int type) +{ + if (type != 1) + abort (); +#pragma omp atomic + cnt++; +} + +template +void +f1 () +{ +#pragma omp parallel for + for (auto i = 0; i < 10; i++) + f0 (i, 0); +} + +template +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 +void +f4 () +{ +#pragma omp parallel for + for (auto i = p; i < p + 10; i++) + f0 (i, 1); +} + +template +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 (); + if (cnt != 10) + abort (); + f2 (); + if (cnt != 20) + abort (); + f3 (); + if (cnt != 30) + abort (); + f4 (); + if (cnt != 40) + abort (); + f5 (); + if (cnt != 50) + abort (); + f6 (); + if (cnt != 60) + abort (); +} -- cgit v1.2.1