aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/explicit18.C
blob: c8916fa4743b183618cd971d36b3175992554478 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// PR c++/100065
// { dg-do compile { target c++20 } }

template<bool B>
struct bool_constant {
  static constexpr bool value = B;
  constexpr operator bool() const { return value; }
};

using true_type = bool_constant<true>;
using false_type = bool_constant<false>;

template<bool>
struct X {
    template<typename T>
    X(T);
};

template<bool b>
explicit(b) X(bool_constant<b>) -> X<b>;

X false_ = false_type{}; // OK
X true_  = true_type{};  // { dg-error "explicit deduction guide" }