1 // RUN: %clang_cc1 %s -fopenacc -verify
3 struct NotConvertible
{} NC
;
7 struct AmbiguousConvert
{
8 operator int(); // #AMBIG_INT
9 operator short(); // #AMBIG_SHORT
13 struct ExplicitConvertOnly
{
14 explicit operator int() const; // #EXPL_CONV
19 #pragma acc wait(getS(), getI())
20 #pragma acc wait(devnum:getS(): getI())
21 #pragma acc wait(devnum:getS(): queues: getI(), getS())
22 #pragma acc wait(devnum:getS(): getI(), getS())
24 // expected-error@+1{{OpenACC directive 'wait' requires expression of integer type ('struct NotConvertible' invalid)}}
25 #pragma acc wait(devnum:NC : 5)
26 // expected-error@+1{{OpenACC directive 'wait' requires expression of integer type ('struct NotConvertible' invalid)}}
27 #pragma acc wait(devnum:5 : NC)
28 // expected-error@+3{{OpenACC directive 'wait' requires expression of integer type ('int[5]' invalid)}}
29 // expected-error@+2{{OpenACC directive 'wait' requires expression of integer type ('int[5]' invalid)}}
30 // expected-error@+1{{OpenACC directive 'wait' requires expression of integer type ('struct NotConvertible' invalid)}}
31 #pragma acc wait(devnum:arr : queues: arr, NC, 5)
33 // expected-error@+3{{multiple conversions from expression type 'struct AmbiguousConvert' to an integral type}}
34 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
35 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
36 #pragma acc wait(Ambiguous)
38 // expected-error@+2{{OpenACC integer expression requires explicit conversion from 'struct ExplicitConvertOnly' to 'int'}}
39 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
40 #pragma acc wait(4, Explicit, 5)
42 // expected-error@+1{{use of undeclared identifier 'queues'}}
43 #pragma acc wait(devnum: queues: 5)
45 #pragma acc wait async
46 #pragma acc wait async(getI())
47 // expected-error@+1{{OpenACC clause 'async' requires expression of integer type ('struct NotConvertible' invalid)}}
48 #pragma acc wait async(NC)
50 #pragma acc wait if(getI() < getS())
51 // expected-error@+1{{value of type 'struct NotConvertible' is not contextually convertible to 'bool'}}
52 #pragma acc wait if(NC)
58 // expected-error@+4{{multiple conversions from expression type 'const AmbiguousConvert' to an integral type}}
59 // expected-note@#INST{{in instantiation of function template specialization}}
60 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
61 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
62 #pragma acc wait(devnum:T::value :queues:T::ACValue)
64 // expected-error@+5{{OpenACC integer expression requires explicit conversion from 'const ExplicitConvertOnly' to 'int'}}
65 // expected-note@#EXPL_CONV{{conversion to integral type 'int'}}
66 // expected-error@+3{{multiple conversions from expression type 'const AmbiguousConvert' to an integral type}}
67 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
68 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
69 #pragma acc wait(devnum:T::EXValue :queues:T::ACValue)
71 // expected-error@+1{{no member named 'Invalid' in 'HasInt'}}
72 #pragma acc wait(queues: T::Invalid, T::Invalid2)
74 // expected-error@+3{{multiple conversions from expression type 'const AmbiguousConvert' to an integral type}}
75 // expected-note@#AMBIG_INT{{conversion to integral type 'int'}}
76 // expected-note@#AMBIG_SHORT{{conversion to integral type 'short'}}
77 #pragma acc wait async(T::ACValue)
79 #pragma acc wait if(T::value < T{})
80 // expected-error@+1{{value of type 'const ExplicitConvertOnly' is not contextually convertible to 'bool'}}
81 #pragma acc wait if(T::EXValue)
86 using ShortTy
= short;
87 static constexpr int value
= 1;
88 static constexpr AmbiguousConvert ACValue
;
89 static constexpr ExplicitConvertOnly EXValue
;
94 TestInst
<HasInt
>(); // #INST