1 // RUN: %clang_cc1 -std=c++11 -verify -fopenmp -ferror-limit 200 %s
2 struct ST {
3 int *a;
4 };
5 struct SA {
6 const int d = 5;
7 const int da[5] = { 0 };
8 ST e;
9 ST g[10];
10 int i;
11 int &j = i;
12 int *k = &j;
13 int *&z = k;
14 int aa[10];
funcSA15 void func(int arg) {
16 #pragma omp target data map(i) use_device_ptr // expected-error {{expected '(' after 'use_device_ptr'}}
17 {}
18 #pragma omp target data map(i) use_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
19 {}
20 #pragma omp target data map(i) use_device_ptr() // expected-error {{expected expression}}
21 {}
22 #pragma omp target data map(i) use_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
23 {}
24 #pragma omp target data map(i) use_device_ptr(arg // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
25 {}
26 #pragma omp target data map(i) use_device_ptr(i) // expected-error {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
27 {}
28 #pragma omp target data map(i) use_device_ptr(j) // expected-error {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
29 {}
30 #pragma omp target data map(i) use_device_ptr(k) // OK
31 {}
32 #pragma omp target data map(i) use_device_ptr(z) // OK
33 {}
34 #pragma omp target data map(i) use_device_ptr(aa) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
35 {}
36 #pragma omp target data map(i) use_device_ptr(e) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
37 {}
38 #pragma omp target data map(i) use_device_ptr(g) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
39 {}
40 #pragma omp target data map(i) use_device_ptr(k,i,j) // expected-error2 {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
41 {}
42 #pragma omp target data map(i) use_device_ptr(d) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
43 {}
44 #pragma omp target data map(i) use_device_ptr(da) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
45 {}
46 return;
47 }
48 };
49 struct SB {
50 unsigned A;
51 unsigned B;
52 float Arr[100];
53 float *Ptr;
fooSB54 float *foo() {
55 return &Arr[0];
56 }
57 };
58
59 struct SC {
60 unsigned A : 2;
61 unsigned B : 3;
62 unsigned C;
63 unsigned D;
64 float Arr[100];
65 SB S;
66 SB ArrS[100];
67 SB *PtrS;
68 SB *&RPtrS;
69 float *Ptr;
70
SCSC71 SC(SB *&_RPtrS) : RPtrS(_RPtrS) {}
72 };
73
74 union SD {
75 unsigned A;
76 float B;
77 };
78
79 struct S1;
80 extern S1 a;
81 class S2 {
82 mutable int a;
83 public:
S2()84 S2():a(0) { }
S2(S2 & s2)85 S2(S2 &s2):a(s2.a) { }
86 static float S2s;
87 static const float S2sc;
88 };
89 const float S2::S2sc = 0;
90 const S2 b;
91 const S2 ba[5];
92 class S3 {
93 int a;
94 public:
S3()95 S3():a(0) { }
S3(S3 & s3)96 S3(S3 &s3):a(s3.a) { }
97 };
98 const S3 c;
99 const S3 ca[5];
100 extern const int f;
101 class S4 {
102 int a;
103 S4();
104 S4(const S4 &s4);
105 public:
S4(int v)106 S4(int v):a(v) { }
107 };
108 class S5 {
109 int a;
S5()110 S5():a(0) {}
S5(const S5 & s5)111 S5(const S5 &s5):a(s5.a) { }
112 public:
S5(int v)113 S5(int v):a(v) { }
114 };
115
116 S3 h;
117 #pragma omp threadprivate(h)
118
119 typedef int from;
120
121 template <typename T, int I>
tmain(T argc)122 T tmain(T argc) {
123 const T d = 5;
124 const T da[5] = { 0 };
125 S4 e(4);
126 S5 g(5);
127 T i;
128 T &j = i;
129 T *k = &j;
130 T *&z = k;
131 T aa[10];
132 #pragma omp target data map(i) use_device_ptr // expected-error {{expected '(' after 'use_device_ptr'}}
133 {}
134 #pragma omp target data map(i) use_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
135 {}
136 #pragma omp target data map(i) use_device_ptr() // expected-error {{expected expression}}
137 {}
138 #pragma omp target data map(i) use_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
139 {}
140 #pragma omp target data map(i) use_device_ptr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
141 {}
142 #pragma omp target data map(i) use_device_ptr(i) // expected-error {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
143 {}
144 #pragma omp target data map(i) use_device_ptr(j) // expected-error {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
145 {}
146 #pragma omp target data map(i) use_device_ptr(k) // OK
147 {}
148 #pragma omp target data map(i) use_device_ptr(z) // OK
149 {}
150 #pragma omp target data map(i) use_device_ptr(aa) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
151 {}
152 #pragma omp target data map(i) use_device_ptr(e) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
153 {}
154 #pragma omp target data map(i) use_device_ptr(g) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
155 {}
156 #pragma omp target data map(i) use_device_ptr(k,i,j) // expected-error2 {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
157 {}
158 #pragma omp target data map(i) use_device_ptr(d) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
159 {}
160 #pragma omp target data map(i) use_device_ptr(da) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
161 {}
162 return 0;
163 }
164
main(int argc,char ** argv)165 int main(int argc, char **argv) {
166 const int d = 5;
167 const int da[5] = { 0 };
168 S4 e(4);
169 S5 g(5);
170 int i;
171 int &j = i;
172 int *k = &j;
173 int *&z = k;
174 int aa[10];
175 #pragma omp target data map(i) use_device_ptr // expected-error {{expected '(' after 'use_device_ptr'}}
176 {}
177 #pragma omp target data map(i) use_device_ptr( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
178 {}
179 #pragma omp target data map(i) use_device_ptr() // expected-error {{expected expression}}
180 {}
181 #pragma omp target data map(i) use_device_ptr(alloc) // expected-error {{use of undeclared identifier 'alloc'}}
182 {}
183 #pragma omp target data map(i) use_device_ptr(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
184 {}
185 #pragma omp target data map(i) use_device_ptr(i) // expected-error {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
186 {}
187 #pragma omp target data map(i) use_device_ptr(j) // expected-error {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
188 {}
189 #pragma omp target data map(i) use_device_ptr(k) // OK
190 {}
191 #pragma omp target data map(i) use_device_ptr(z) // OK
192 {}
193 #pragma omp target data map(i) use_device_ptr(aa) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
194 {}
195 #pragma omp target data map(i) use_device_ptr(e) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
196 {}
197 #pragma omp target data map(i) use_device_ptr(g) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
198 {}
199 #pragma omp target data map(i) use_device_ptr(k,i,j) // expected-error2 {{expected pointer or reference to pointer in 'use_device_ptr' clause}}
200 {}
201 #pragma omp target data map(i) use_device_ptr(d) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
202 {}
203 #pragma omp target data map(i) use_device_ptr(da) // expected-error{{expected pointer or reference to pointer in 'use_device_ptr' clause}}
204 {}
205 return tmain<int, 3>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}}
206 }
207