| 1 |
// RUN: %clang_cc1 %s -fopenacc -verify |
| 2 |
|
| 3 |
void 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 |
|
| 10 |
void foo2() { |
| 11 |
#pragma acc loop |
| 12 |
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 |
|
| 20 |
template<typename T> |
| 21 |
void 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 |
|
| 27 |
void Inst() { |
| 28 |
foo3<int>(); |
| 29 |
} |