| 1 |
// PR c++/100065 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
template<bool B> |
| 5 |
struct bool_constant { |
| 6 |
static constexpr bool value = B; |
| 7 |
constexpr operator bool() const { return value; } |
| 8 |
}; |
| 9 |
|
| 10 |
using true_type = bool_constant<true>; |
| 11 |
using false_type = bool_constant<false>; |
| 12 |
|
| 13 |
template<bool> |
| 14 |
struct X { |
| 15 |
template<typename T> |
| 16 |
X(T); |
| 17 |
}; |
| 18 |
|
| 19 |
template<bool b> |
| 20 |
explicit(b) X(bool_constant<b>) -> X<b>; |
| 21 |
|
| 22 |
X false_ = false_type{}; // OK |
| 23 |
X true_ = true_type{}; // { dg-error "explicit deduction guide" } |