aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaOpenACC/compute-construct-if-clause.cpp
blob: 2a9bb8a3d5c4eaf4f91a83027c46e6b41e77afd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// RUN: %clang_cc1 %s -fopenacc -verify

struct NoBoolConversion{};
struct BoolConversion{
  operator bool();
};

template <typename T, typename U>
void BoolExpr() {

  // expected-error@+1{{value of type 'NoBoolConversion' is not contextually convertible to 'bool'}}
#pragma acc parallel if (NoBoolConversion{})
  while(0);

  // expected-error@+2{{no member named 'NotValid' in 'NoBoolConversion'}}
  // expected-note@#INST{{in instantiation of function template specialization}}
#pragma acc parallel if (T::NotValid)
  while(0);

#pragma acc parallel if (BoolConversion{})
  while(0);

  // expected-error@+1{{value of type 'NoBoolConversion' is not contextually convertible to 'bool'}}
#pragma acc parallel if (T{})
  while(0);

#pragma acc parallel if (U{})
  while(0);
}

void Instantiate() {
  BoolExpr<NoBoolConversion, BoolConversion>(); // #INST
}