1 // RUN: %clang_cc1 %s -fopenacc -verify
3 struct ExplicitConvertOnly
{
4 explicit operator int() const; // #EXPL_CONV
7 struct AmbiguousConvert
{
8 operator int(); // #AMBIG_INT
9 operator short(); // #AMBIG_SHORT
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)
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)
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)
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)
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)
42 // expected-error@+1{{use of undeclared identifier 'queues'}}
43 #pragma acc parallel wait(devnum: queues: 5)
49 using ShortTy
= short;
50 static constexpr int value
= 1;
51 static constexpr AmbiguousConvert ACValue
;
52 static constexpr ExplicitConvertOnly EXValue
;
60 #pragma acc parallel wait(T{})
63 #pragma acc parallel wait(devnum:typename T::ShortTy{}:queues:typename T::IntTy{})
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)
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)
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)
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)
97 // expected-error@+1{{no member named 'Invalid' in 'HasInt'}}
98 #pragma acc parallel wait(queues: T::Invalid, T::Invalid2)
103 TestInst
<HasInt
>(); // #INST