xref: /llvm-project/clang/test/ParserOpenACC/parse-constructs.cpp (revision db4ea21dfde307f4fc873a6fe56791cd7ae3f0a1)
1ba1c869fSErich Keane // RUN: %clang_cc1 %s -verify -fopenacc
2ba1c869fSErich Keane 
3ba1c869fSErich Keane namespace NS {
4ba1c869fSErich Keane   void foo(); // expected-note{{declared here}}
5ba1c869fSErich Keane 
6ba1c869fSErich Keane   template<typename T>
7ba1c869fSErich Keane   void templ(); // expected-note 2{{declared here}}
858b77b85Serichkeane 
958b77b85Serichkeane   class C { // #CDef
1058b77b85Serichkeane     void private_mem_func(); // #PrivateMemFunc
1158b77b85Serichkeane     public:
1258b77b85Serichkeane     void public_mem_func();
1358b77b85Serichkeane   };
14ba1c869fSErich Keane }
15ba1c869fSErich Keane 
16ba1c869fSErich Keane // expected-error@+2{{use of undeclared identifier 'foo'; did you mean 'NS::foo'?}}
17*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
18ba1c869fSErich Keane #pragma acc routine(foo)
19*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
20ba1c869fSErich Keane #pragma acc routine(NS::foo)
21ba1c869fSErich Keane 
22ba1c869fSErich Keane // expected-error@+2{{use of undeclared identifier 'templ'; did you mean 'NS::templ'?}}
23*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
24ba1c869fSErich Keane #pragma acc routine(templ)
25*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
26ba1c869fSErich Keane #pragma acc routine(NS::templ)
27ba1c869fSErich Keane 
28ba1c869fSErich Keane // expected-error@+2{{use of undeclared identifier 'templ'; did you mean 'NS::templ'?}}
29*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
30ba1c869fSErich Keane #pragma acc routine(templ<int>)
31*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
32ba1c869fSErich Keane #pragma acc routine(NS::templ<int>)
33ba1c869fSErich Keane 
34ba1c869fSErich Keane // expected-error@+2{{use of undeclared identifier 'T'}}
35*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
36ba1c869fSErich Keane #pragma acc routine(templ<T>)
37ba1c869fSErich Keane // expected-error@+2{{use of undeclared identifier 'T'}}
38*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
39ba1c869fSErich Keane #pragma acc routine(NS::templ<T>)
40ba1c869fSErich Keane 
41ba1c869fSErich Keane // expected-error@+3{{expected ')'}}
42ba1c869fSErich Keane // expected-note@+2{{to match this '('}}
43*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
44ba1c869fSErich Keane #pragma acc routine (NS::foo())
45ba1c869fSErich Keane 
46ba1c869fSErich Keane // expected-error@+2 {{expected unqualified-id}}
47*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
48ba1c869fSErich Keane #pragma acc routine()
49ba1c869fSErich Keane 
50ba1c869fSErich Keane // expected-error@+2 {{expected unqualified-id}}
51*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
52ba1c869fSErich Keane #pragma acc routine(int)
5358b77b85Serichkeane 
5458b77b85Serichkeane // expected-error@+3{{'C' does not refer to a value}}
5558b77b85Serichkeane // expected-note@#CDef{{declared here}}
56*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
5758b77b85Serichkeane #pragma acc routine (NS::C)
5858b77b85Serichkeane // expected-error@+3{{'private_mem_func' is a private member of 'NS::C'}}
5958b77b85Serichkeane // expected-note@#PrivateMemFunc{{implicitly declared private here}}
60*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
6158b77b85Serichkeane #pragma acc routine (NS::C::private_mem_func)
62*db4ea21dSerichkeane // expected-warning@+1{{OpenACC construct 'routine' not yet implemented, pragma ignored}}
6358b77b85Serichkeane #pragma acc routine (NS::C::public_mem_func)
64