]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/OpenMP/target_parallel_firstprivate_messages.cpp
Vendor import of clang trunk r338150:
[FreeBSD/FreeBSD.git] / test / OpenMP / target_parallel_firstprivate_messages.cpp
1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
2
3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
4
5 void foo() {
6 }
7
8 bool foobool(int argc) {
9   return argc;
10 }
11
12 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
13 extern S1 a;
14 class S2 {
15   mutable int a;
16 public:
17   S2():a(0) { }
18   S2(const S2 &s2):a(s2.a) { }
19   static float S2s;
20   static const float S2sc;
21 };
22 const float S2::S2sc = 0;
23 const S2 b;
24 const S2 ba[5];
25 class S3 {
26   int a;
27 public:
28   S3():a(0) { }
29   S3(const S3 &s3):a(s3.a) { }
30 };
31 const S3 c;
32 const S3 ca[5];
33 extern const int f;
34 class S4 {
35   int a;
36   S4();
37   S4(const S4 &s4); // expected-note {{implicitly declared private here}}
38 public:
39   S4(int v):a(v) { }
40 };
41 class S5 {
42   int a;
43   S5():a(0) {}
44   S5(const S5 &s5):a(s5.a) { } // expected-note {{implicitly declared private here}}
45 public:
46   S5(int v):a(v) { }
47 };
48
49 S3 h;
50 #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}}
51
52 namespace A {
53 double x;
54 #pragma omp threadprivate(x) // expected-note {{defined as threadprivate or thread local}}
55 }
56 namespace B {
57 using A::x;
58 }
59
60 int main(int argc, char **argv) {
61   const int d = 5;
62   const int da[5] = { 0 };
63   S4 e(4);
64   S5 g(5);
65   int i;
66   int &j = i;
67   static int m;
68   #pragma omp target parallel firstprivate // expected-error {{expected '(' after 'firstprivate'}}
69   foo();
70   #pragma omp target parallel firstprivate ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
71   foo();
72   #pragma omp target parallel firstprivate () // expected-error {{expected expression}}
73   foo();
74   #pragma omp target parallel firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
75   foo();
76   #pragma omp target parallel firstprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
77   foo();
78   #pragma omp target parallel firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
79   foo();
80   #pragma omp target parallel firstprivate (argc)
81   foo();
82   #pragma omp target parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}}
83   foo();
84   #pragma omp target parallel firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
85   foo();
86   #pragma omp target parallel firstprivate (argv[1]) // expected-error {{expected variable name}}
87   foo();
88   #pragma omp target parallel firstprivate(ba)
89   foo();
90   #pragma omp target parallel firstprivate(ca)
91   foo();
92   #pragma omp target parallel firstprivate(da)
93   foo();
94   #pragma omp target parallel firstprivate(S2::S2s)
95   foo();
96   #pragma omp target parallel firstprivate(S2::S2sc)
97   foo();
98   #pragma omp target parallel firstprivate(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
99   foo();
100   #pragma omp target parallel firstprivate(h, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be firstprivate}}
101   foo();
102   #pragma omp target parallel private(i), firstprivate(i) // expected-error {{private variable cannot be firstprivate}} expected-note{{defined as private}}
103   foo();
104   #pragma omp target parallel shared(i)
105   foo();
106   #pragma omp target parallel firstprivate(i)
107   foo();
108   #pragma omp target parallel firstprivate(j)
109   foo();
110   #pragma omp target parallel firstprivate(m)
111   foo();
112
113   return 0;
114 }