xref: /llvm-project/clang/test/SemaOpenACC/data-construct-async-clause.c (revision fbb14dd97702db242a31e1b36ca8a3554a73c212)
1 // RUN: %clang_cc1 %s -fopenacc -verify
2 
3 void Test() {
4   int I;
5   struct NotConvertible{} NC;
6   // No special rules for this clause on the data constructs, so not much to
7   // test that isn't covered by combined/compute.
8 #pragma acc data copyin(I) async(I)
9   ;
10 #pragma acc enter data copyin(I) async(I)
11 #pragma acc exit data copyout(I) async(I)
12   // expected-error@+1{{OpenACC 'async' clause is not valid on 'host_data' directive}}
13 #pragma acc host_data use_device(I) async(I)
14   ;
15 
16   // expected-error@+1{{OpenACC clause 'async' requires expression of integer type ('struct NotConvertible' invalid)}}
17 #pragma acc data copyin(NC) async(NC)
18   ;
19   // expected-error@+1{{OpenACC clause 'async' requires expression of integer type ('struct NotConvertible' invalid)}}
20 #pragma acc enter data copyin(NC) async(NC)
21   // expected-error@+1{{OpenACC clause 'async' requires expression of integer type ('struct NotConvertible' invalid)}}
22 #pragma acc exit data copyout(NC) async(NC)
23   // expected-error@+1{{OpenACC clause 'async' requires expression of integer type ('struct NotConvertible' invalid)}}
24 #pragma acc host_data use_device(NC) async(NC)
25   ;
26 
27   // expected-error@+2{{OpenACC 'async' clause cannot appear more than once on a 'data' directive}}
28   // expected-note@+1{{previous clause is here}}
29 #pragma acc data copyin(I) async(I) async(I)
30   ;
31   // expected-error@+2{{expected ')'}}
32   // expected-note@+1{{to match this '('}}
33 #pragma acc enter data copyin(I) async(I, I)
34 }
35