1 // RUN: %clang_cc1 %s -verify -fopenacc
4 static char* NSArray
;// expected-note{{declared here}}
5 static int NSInt
;// expected-note 2{{declared here}}
8 template<typename T
, int I
>
10 char *ArrayPtr
= getArrayPtr();
11 for (int i
= 0; i
< 10; ++i
) {
12 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
13 #pragma acc cache(ArrayPtr[T::value + I:I + 5], T::array[(i + T::value, 5): 6])
15 for (int i
= 0; i
< 10; ++i
) {
16 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
17 #pragma acc cache(NS::NSArray[NS::NSInt])
20 for (int i
= 0; i
< 10; ++i
) {
21 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
22 #pragma acc cache(NS::NSArray[NS::NSInt : NS::NSInt])
25 for (int i
= 0; i
< 10; ++i
) {
26 // expected-error@+2{{use of undeclared identifier 'NSArray'; did you mean 'NS::NSArray'}}
27 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
28 #pragma acc cache(NSArray[NS::NSInt : NS::NSInt])
31 for (int i
= 0; i
< 10; ++i
) {
32 // expected-error@+2{{use of undeclared identifier 'NSInt'; did you mean 'NS::NSInt'}}
33 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
34 #pragma acc cache(NS::NSArray[NSInt : NS::NSInt])
37 for (int i
= 0; i
< 10; ++i
) {
38 // expected-error@+2{{use of undeclared identifier 'NSInt'; did you mean 'NS::NSInt'}}
39 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
40 #pragma acc cache(NS::NSArray[NS::NSInt : NSInt])
45 static constexpr int value
= 5;
46 static constexpr char array
[] ={1,2,3,4,5};
51 char array
[5] ={1,2,3,4,5};
53 struct HasMembersArray
{
61 for (int i
= 0; i
< 10; ++i
) {
62 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
63 #pragma acc cache(s.array[s.value])
66 for (int i
= 0; i
< 10; ++i
) {
67 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
68 #pragma acc cache(Arrs.MemArr[3].array[4])
70 for (int i
= 0; i
< 10; ++i
) {
71 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
72 #pragma acc cache(Arrs.MemArr[3].array[1:4])
74 for (int i
= 0; i
< 10; ++i
) {
75 // expected-error@+2{{OpenACC sub-array is not allowed here}}
76 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
77 #pragma acc cache(Arrs.MemArr[2:1].array[1:4])
79 for (int i
= 0; i
< 10; ++i
) {
80 // expected-error@+2{{OpenACC sub-array is not allowed here}}
81 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
82 #pragma acc cache(Arrs.MemArr[2:1].array[4])
84 for (int i
= 0; i
< 10; ++i
) {
85 // expected-error@+3{{expected ']'}}
86 // expected-note@+2{{to match this '['}}
87 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
88 #pragma acc cache(Arrs.MemArr[3:4:].array[4])
90 for (int i
= 0; i
< 10; ++i
) {
91 // expected-error@+2{{OpenACC sub-array is not allowed here}}
92 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
93 #pragma acc cache(Arrs.MemArr[:].array[4])
95 for (int i
= 0; i
< 10; ++i
) {
96 // expected-error@+2{{expected unqualified-id}}
97 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
98 #pragma acc cache(Arrs.MemArr[::].array[4])
100 for (int i
= 0; i
< 10; ++i
) {
101 // expected-error@+4{{expected expression}}
102 // expected-error@+3{{expected ']'}}
103 // expected-note@+2{{to match this '['}}
104 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
105 #pragma acc cache(Arrs.MemArr[: :].array[4])
107 for (int i
= 0; i
< 10; ++i
) {
108 // expected-error@+2{{OpenACC sub-array is not allowed here}}
109 // expected-warning@+1{{OpenACC construct 'cache' not yet implemented, pragma ignored}}
110 #pragma acc cache(Arrs.MemArr[3:].array[4])