34 lines · cpp
1// RUN: %clang_cc1 %s -fopenacc -verify2 3struct NoBoolConversion{};4struct BoolConversion{5 operator bool();6};7 8template <typename T, typename U>9void BoolExpr() {10 11 // expected-error@+1{{value of type 'NoBoolConversion' is not contextually convertible to 'bool'}}12#pragma acc parallel if (NoBoolConversion{})13 while(0);14 15 // expected-error@+2{{no member named 'NotValid' in 'NoBoolConversion'}}16 // expected-note@#INST{{in instantiation of function template specialization}}17#pragma acc parallel if (T::NotValid)18 while(0);19 20#pragma acc parallel if (BoolConversion{})21 while(0);22 23 // expected-error@+1{{value of type 'NoBoolConversion' is not contextually convertible to 'bool'}}24#pragma acc parallel if (T{})25 while(0);26 27#pragma acc parallel if (U{})28 while(0);29}30 31void Instantiate() {32 BoolExpr<NoBoolConversion, BoolConversion>(); // #INST33}34