[libc++] Refactor the sequence container benchmarks (#119763)
[llvm-project.git] / clang / test / SemaOpenACC / loop-loc-and-stmt.cpp
blob898eb55c4bedacb4f1b8c3d975a771645c3c7bd9
1 // RUN: %clang_cc1 %s -verify -fopenacc
2 //
3 // expected-error@+1{{OpenACC construct 'loop' cannot be used here; it can only be used in a statement context}}
4 #pragma acc loop
6 // expected-error@+1{{OpenACC construct 'loop' cannot be used here; it can only be used in a statement context}}
7 #pragma acc loop
8 int foo;
10 struct S {
11 // expected-error@+1{{OpenACC construct 'loop' cannot be used here; it can only be used in a statement context}}
12 #pragma acc loop
13 int i;
15 void mem_func() {
16 // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}}
17 // expected-note@+1{{'loop' construct is here}}
18 #pragma acc loop
19 int foo;
21 // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}}
22 // expected-note@+1{{'loop' construct is here}}
23 #pragma acc loop
24 while(0);
26 // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}}
27 // expected-note@+1{{'loop' construct is here}}
28 #pragma acc loop
29 do{}while(0);
31 // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}}
32 // expected-note@+1{{'loop' construct is here}}
33 #pragma acc loop
36 #pragma acc loop
37 for(int i = 0; i < 6; ++i);
39 int array[5];
41 #pragma acc loop
42 for(auto X : array){}
46 template<typename T>
47 void templ_func() {
48 // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}}
49 // expected-note@+1{{'loop' construct is here}}
50 #pragma acc loop
51 int foo;
53 // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}}
54 // expected-note@+1{{'loop' construct is here}}
55 #pragma acc loop
56 while(T{});
58 // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}}
59 // expected-note@+1{{'loop' construct is here}}
60 #pragma acc loop
61 do{}while(0);
63 // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}}
64 // expected-note@+1{{'loop' construct is here}}
65 #pragma acc loop
68 #pragma acc loop
69 for(T i = 0; i < 1; ++i);
71 T array[5];
73 #pragma acc loop
74 for(auto X : array){}
77 void use() {
78 templ_func<int>();