diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/gomp/pr89796.C')
-rw-r--r-- | gcc/testsuite/g++.dg/gomp/pr89796.C | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/gomp/pr89796.C b/gcc/testsuite/g++.dg/gomp/pr89796.C new file mode 100644 index 00000000000..6bbc34eae32 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr89796.C @@ -0,0 +1,53 @@ +// PR c++/89796 +// { dg-do compile } +// { dg-additional-options "-Wunused-value" } + +int +f1 (int &c) +{ + int r; + #pragma omp atomic capture // { dg-bogus "value computed is not used" } + { r = c; c++; } + return r; +} + +template <int N> +int +f2 (int &c) +{ + int r; + #pragma omp atomic capture // { dg-bogus "value computed is not used" } + { r = c; c++; } + return r; +} + +int +f3 (int &c) +{ + return f2 <0> (c); +} + +int +f4 (int *p) +{ + int r; + #pragma omp atomic capture // { dg-bogus "value computed is not used" } + { r = *p; (*p)++; } + return r; +} + +template <int N> +int +f5 (int *p) +{ + int r; + #pragma omp atomic capture // { dg-bogus "value computed is not used" } + { r = *p; (*p)++; } + return r; +} + +int +f6 (int *p) +{ + return f5 <0> (p); +} |