1 // RUN: %clang_cc1 %s -fopenacc -verify
4 typedef struct IsComplete
{
5 struct S
{ int A
; } CompositeMember
;
12 void uses(int IntParam
, char *PointerParam
, float ArrayParam
[5], Complete CompositeParam
, int &IntParamRef
) {
16 // Check Appertainment:
17 #pragma acc parallel copy(LocalInt)
19 #pragma acc serial copy(LocalInt)
21 #pragma acc kernels copy(LocalInt)
25 #pragma acc parallel copy(LocalInt, LocalPointer, LocalArray)
27 #pragma acc parallel copy(LocalArray[2:1])
30 Complete LocalComposite2
;
31 #pragma acc parallel copy(LocalComposite2.ScalarMember, LocalComposite2.ScalarMember)
34 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
35 #pragma acc parallel copy(1 + IntParam)
38 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
39 #pragma acc parallel copy(+IntParam)
42 // expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}}
43 #pragma acc parallel copy(PointerParam[2:])
46 // expected-error@+1{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
47 #pragma acc parallel copy(ArrayParam[2:5])
50 // expected-error@+2{{OpenACC sub-array specified range [2:5] would be out of the range of the subscripted array size of 5}}
51 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
52 #pragma acc parallel copy((float*)ArrayParam[2:5])
54 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
55 #pragma acc parallel copy((float)ArrayParam[2])
59 template<typename T
, unsigned I
, typename V
>
60 void TemplUses(T t
, T (&arrayT
)[I
], V TemplComp
) {
61 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
62 #pragma acc parallel copy(+t)
65 // NTTP's are only valid if it is a reference to something.
66 // expected-error@+2{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
67 // expected-note@#TEMPL_USES_INST{{in instantiation of}}
68 #pragma acc parallel copy(I)
71 // expected-error@+1{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
72 #pragma acc parallel copy(t, I)
75 #pragma acc parallel copy(arrayT)
78 #pragma acc parallel copy(TemplComp)
81 #pragma acc parallel copy(TemplComp.PointerMember[5])
84 #pragma acc parallel copy(Pointer[:I])
86 #pragma acc parallel copy(Pointer[:t])
88 // expected-error@+1{{OpenACC sub-array length is unspecified and cannot be inferred because the subscripted value is not an array}}
89 #pragma acc parallel copy(Pointer[1:])
93 template<unsigned I
, auto &NTTP_REF
>
95 // NTTP's are only valid if it is a reference to something.
96 // expected-error@+2{{OpenACC variable is not a valid variable name, sub-array, array element, member of a composite variable, or composite variable member}}
97 // expected-note@#NTTP_INST{{in instantiation of}}
98 #pragma acc parallel copy(I)
101 #pragma acc parallel copy(NTTP_REF)
106 static constexpr int NTTP_REFed
= 1;
110 TemplUses(i
, Arr
, C
); // #TEMPL_USES_INST
111 NTTP
<5, NTTP_REFed
>(); // #NTTP_INST