30 lines · cpp
1// RUN: %clang_cc1 %s -fopenacc -verify2 3void foo() {4 int Array[5];5 // expected-warning@+1 2{{OpenACC variable in 'cache' directive was not declared outside of the associated 'loop' directive; directive has no effect}}6 #pragma acc cache(readonly:Array[1], Array[1:2])7}8 9 10void foo2() {11#pragma acc loop12 for(int i = 0; i < 5; ++i) {13 int Array[5];14 // expected-warning@+1 2{{OpenACC variable in 'cache' directive was not declared outside of the associated 'loop' directive; directive has no effect}}15 #pragma acc cache(readonly:Array[1], Array[1:2])16 }17}18 19 20template<typename T>21void foo3() {22 T Array[5];23 // expected-warning@+1 2{{OpenACC variable in 'cache' directive was not declared outside of the associated 'loop' directive; directive has no effect}}24 #pragma acc cache(readonly:Array[1], Array[1:2])25}26 27void Inst() {28 foo3<int>();29}30