Debian Codegraph @

gcc/testsuite/g++.dg/gomp/pr81154.C

raw
1 // PR c++/81154
2 // { dg-do compile }
3
4 template <typename T>
5 struct C
6 {
7 int foo (T n) const
8 {
9 #pragma omp parallel shared (foo) // { dg-error "is not a variable in clause" }
10 ;
11 #pragma omp parallel private (foo) // { dg-error "is not a variable in clause" }
12 ;
13 #pragma omp parallel firstprivate (foo) // { dg-error "is not a variable in clause" }
14 ;
15 #pragma omp parallel for lastprivate (foo) // { dg-error "is not a variable in clause" }
16 for (T i = 0; i < n; i++)
17 ;
18 #pragma omp parallel for linear (foo) // { dg-error "is not a variable in clause" }
19 for (T i = 0; i < n; i++)
20 ;
21 #pragma omp parallel reduction (+:foo) // { dg-error "is not a variable in clause" }
22 ;
23 return 0;
24 }
25 int foo (int x, int y) { return x; }
26 };
27
28 struct D
29 {
30 typedef int T;
31 int foo (T n) const
32 {
33 #pragma omp parallel shared (foo) // { dg-error "is not a variable in clause" }
34 ;
35 #pragma omp parallel private (foo) // { dg-error "is not a variable in clause" }
36 ;
37 #pragma omp parallel firstprivate (foo) // { dg-error "is not a variable in clause" }
38 ;
39 #pragma omp parallel for lastprivate (foo) // { dg-error "is not a variable in clause" }
40 for (T i = 0; i < n; i++)
41 ;
42 #pragma omp parallel for linear (foo) // { dg-error "is not a variable in clause" }
43 for (T i = 0; i < n; i++)
44 ;
45 #pragma omp parallel reduction (+:foo) // { dg-error "is not a variable in clause" }
46 ;
47 return 0;
48 }
49 int foo (int x, int y) { return x; }
50 };
51
52 int
53 main ()
54 {
55 C<int> ().foo (1);
56 D ().foo (1);
57 }