aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaOpenACC/cache-warn-invalid-varloc.cpp
blob: bc24263c669dc34196b02676c7743dac04b0c7af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// RUN: %clang_cc1 %s -fopenacc -verify

void foo() {
  int Array[5];
  // expected-warning@+1 2{{OpenACC variable in 'cache' directive was not declared outside of the associated 'loop' directive; directive has no effect}}
  #pragma acc cache(readonly:Array[1], Array[1:2])
}


void foo2() {
#pragma acc loop
  for(int i = 0; i < 5; ++i) {
    int Array[5];
    // expected-warning@+1 2{{OpenACC variable in 'cache' directive was not declared outside of the associated 'loop' directive; directive has no effect}}
    #pragma acc cache(readonly:Array[1], Array[1:2])
  }
}


template<typename T>
void foo3() {
  T Array[5];
  // expected-warning@+1 2{{OpenACC variable in 'cache' directive was not declared outside of the associated 'loop' directive; directive has no effect}}
  #pragma acc cache(readonly:Array[1], Array[1:2])
}

void Inst() {
  foo3<int>();
}