[RISCV][FMV] Support target_clones (#85786)
[llvm-project.git] / clang / test / SemaOpenACC / compute-construct-wait-clause.cpp
blob94f669be0f672d9ccfe2fc3ac6977460033ea7ae
1 // RUN: %clang_cc1 %s -fopenacc -verify
3 struct ExplicitConvertOnly {
4 explicit operator int() const; // #EXPL_CONV
5 } Explicit;
7 struct AmbiguousConvert{
8 operator int(); // #AMBIG_INT
9 operator short(); // #AMBIG_SHORT
10 operator float();
11 } Ambiguous;
13 void Test() {
15 // expected-error@+3{{multiple conversions from expression type 'struct AmbiguousConvert' to an integral type}}
16 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
17 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
18 #pragma acc parallel wait(Ambiguous)
19 while (true);
21 // expected-error@+2{{OpenACC integer expression type 'struct ExplicitConvertOnly' requires explicit conversion to 'int'}}
22 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
23 #pragma acc parallel wait(4, Explicit, 5)
24 while (true);
26 // expected-error@+3{{multiple conversions from expression type 'struct AmbiguousConvert' to an integral type}}
27 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
28 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
29 #pragma acc parallel wait(queues: Ambiguous, 5)
30 while (true);
32 // expected-error@+2{{OpenACC integer expression type 'struct ExplicitConvertOnly' requires explicit conversion to 'int'}}
33 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
34 #pragma acc parallel wait(devnum: Explicit: 5)
35 while (true);
37 // expected-error@+2{{OpenACC integer expression type 'struct ExplicitConvertOnly' requires explicit conversion to 'int'}}
38 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
39 #pragma acc parallel wait(devnum: Explicit:queues: 5)
40 while (true);
42 // expected-error@+1{{use of undeclared identifier 'queues'}}
43 #pragma acc parallel wait(devnum: queues: 5)
44 while (true);
47 struct HasInt {
48 using IntTy = int;
49 using ShortTy = short;
50 static constexpr int value = 1;
51 static constexpr AmbiguousConvert ACValue;
52 static constexpr ExplicitConvertOnly EXValue;
54 operator char();
57 template<typename T>
58 void TestInst() {
60 #pragma acc parallel wait(T{})
61 while (true);
63 #pragma acc parallel wait(devnum:typename T::ShortTy{}:queues:typename T::IntTy{})
64 while (true);
66 // expected-error@+4{{multiple conversions from expression type 'const AmbiguousConvert' to an integral type}}
67 // expected-note@#INST{{in instantiation of function template specialization}}
68 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
69 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
70 #pragma acc parallel wait(devnum:T::value :queues:T::ACValue)
71 while (true);
73 // expected-error@+5{{OpenACC integer expression type 'const ExplicitConvertOnly' requires explicit conversion to 'int'}}
74 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
75 // expected-error@+3{{multiple conversions from expression type 'const AmbiguousConvert' to an integral type}}
76 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
77 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
78 #pragma acc parallel wait(devnum:T::EXValue :queues:T::ACValue)
79 while (true);
81 // expected-error@+5{{OpenACC integer expression type 'const ExplicitConvertOnly' requires explicit conversion to 'int'}}
82 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
83 // expected-error@+3{{multiple conversions from expression type 'const AmbiguousConvert' to an integral type}}
84 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
85 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
86 #pragma acc parallel wait(T::EXValue, T::ACValue)
87 while (true);
89 // expected-error@+5{{OpenACC integer expression type 'const ExplicitConvertOnly' requires explicit conversion to 'int'}}
90 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
91 // expected-error@+3{{multiple conversions from expression type 'const AmbiguousConvert' to an integral type}}
92 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
93 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
94 #pragma acc parallel wait(queues: T::EXValue, T::ACValue)
95 while (true);
97 // expected-error@+1{{no member named 'Invalid' in 'HasInt'}}
98 #pragma acc parallel wait(queues: T::Invalid, T::Invalid2)
99 while (true);
102 void Inst() {
103 TestInst<HasInt>(); // #INST