llvm-project
113 строк · 4.2 Кб
1// RUN: %clang_cc1 %s -verify -fopenacc
2
3namespace NS {4static char* NSArray;// expected-note{{declared here}}5static int NSInt;// expected-note 2{{declared here}}6}
7char *getArrayPtr();8template<typename T, int I>9void func() {10char *ArrayPtr = getArrayPtr();11for (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])14}15for (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])18}19
20for (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])23}24
25for (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])29}30
31for (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])35}36
37for (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])41}42}
43
44struct S {45static constexpr int value = 5;46static constexpr char array[] ={1,2,3,4,5};47};48
49struct Members {50int value = 5;51char array[5] ={1,2,3,4,5};52};53struct HasMembersArray {54Members MemArr[4];55};56
57
58void use() {59
60Members s;61for (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])64}65HasMembersArray Arrs;66for (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])69}70for (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])73}74for (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])78}79for (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])83}84for (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])89}90for (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])94}95for (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])99}100for (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])106}107for (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])111}112func<S, 5>();113}
114
115