142f4e505SErich Keane // RUN: %clang_cc1 %s -verify -fopenacc 242f4e505SErich Keane // 342f4e505SErich Keane // expected-error@+1{{OpenACC construct 'loop' cannot be used here; it can only be used in a statement context}} 442f4e505SErich Keane #pragma acc loop 542f4e505SErich Keane 642f4e505SErich Keane // expected-error@+1{{OpenACC construct 'loop' cannot be used here; it can only be used in a statement context}} 742f4e505SErich Keane #pragma acc loop 842f4e505SErich Keane int foo; 942f4e505SErich Keane 1042f4e505SErich Keane struct S { 1142f4e505SErich Keane // expected-error@+1{{OpenACC construct 'loop' cannot be used here; it can only be used in a statement context}} 1242f4e505SErich Keane #pragma acc loop 1342f4e505SErich Keane int i; 1442f4e505SErich Keane 1542f4e505SErich Keane void mem_func() { 1642f4e505SErich Keane // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}} 1742f4e505SErich Keane // expected-note@+1{{'loop' construct is here}} 1842f4e505SErich Keane #pragma acc loop 1942f4e505SErich Keane int foo; 2042f4e505SErich Keane 2142f4e505SErich Keane // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}} 2242f4e505SErich Keane // expected-note@+1{{'loop' construct is here}} 2342f4e505SErich Keane #pragma acc loop 2442f4e505SErich Keane while(0); 2542f4e505SErich Keane 2642f4e505SErich Keane // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}} 2742f4e505SErich Keane // expected-note@+1{{'loop' construct is here}} 2842f4e505SErich Keane #pragma acc loop 2942f4e505SErich Keane do{}while(0); 3042f4e505SErich Keane 3142f4e505SErich Keane // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}} 3242f4e505SErich Keane // expected-note@+1{{'loop' construct is here}} 3342f4e505SErich Keane #pragma acc loop 3442f4e505SErich Keane {} 3542f4e505SErich Keane 3642f4e505SErich Keane #pragma acc loop 37*b0cfbfd7SErich Keane for(int i = 0; i < 6; ++i); 3842f4e505SErich Keane 3942f4e505SErich Keane int array[5]; 4042f4e505SErich Keane 4142f4e505SErich Keane #pragma acc loop 4242f4e505SErich Keane for(auto X : array){} 4342f4e505SErich Keane } 4442f4e505SErich Keane }; 4542f4e505SErich Keane 4642f4e505SErich Keane template<typename T> 4742f4e505SErich Keane void templ_func() { 4842f4e505SErich Keane // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}} 4942f4e505SErich Keane // expected-note@+1{{'loop' construct is here}} 5042f4e505SErich Keane #pragma acc loop 5142f4e505SErich Keane int foo; 5242f4e505SErich Keane 5342f4e505SErich Keane // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}} 5442f4e505SErich Keane // expected-note@+1{{'loop' construct is here}} 5542f4e505SErich Keane #pragma acc loop 5642f4e505SErich Keane while(T{}); 5742f4e505SErich Keane 5842f4e505SErich Keane // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}} 5942f4e505SErich Keane // expected-note@+1{{'loop' construct is here}} 6042f4e505SErich Keane #pragma acc loop 6142f4e505SErich Keane do{}while(0); 6242f4e505SErich Keane 6342f4e505SErich Keane // expected-error@+3{{OpenACC 'loop' construct can only be applied to a 'for' loop}} 6442f4e505SErich Keane // expected-note@+1{{'loop' construct is here}} 6542f4e505SErich Keane #pragma acc loop 6642f4e505SErich Keane {} 6742f4e505SErich Keane 6842f4e505SErich Keane #pragma acc loop 69*b0cfbfd7SErich Keane for(T i = 0; i < 1; ++i); 7042f4e505SErich Keane 7142f4e505SErich Keane T array[5]; 7242f4e505SErich Keane 7342f4e505SErich Keane #pragma acc loop 7442f4e505SErich Keane for(auto X : array){} 7542f4e505SErich Keane } 7642f4e505SErich Keane 7742f4e505SErich Keane void use() { 7842f4e505SErich Keane templ_func<int>(); 7942f4e505SErich Keane } 8042f4e505SErich Keane 81