| 1 |
// PR c++/93551 |
| 2 |
// { dg-do compile { target concepts } } |
| 3 |
|
| 4 |
namespace std { |
| 5 |
template<typename _Tp, _Tp __v> |
| 6 |
struct integral_constant |
| 7 |
{ |
| 8 |
static constexpr _Tp value = __v; |
| 9 |
typedef _Tp value_type; |
| 10 |
typedef integral_constant<_Tp, __v> type; |
| 11 |
constexpr operator value_type() const noexcept { return value; } |
| 12 |
}; |
| 13 |
template<typename _Base, typename _Derived> |
| 14 |
struct is_base_of |
| 15 |
: public integral_constant<bool, __is_base_of(_Base, _Derived)> |
| 16 |
{ }; |
| 17 |
template <typename _Base, typename _Derived> |
| 18 |
inline constexpr bool is_base_of_v = is_base_of<_Base, _Derived>::value; |
| 19 |
} |
| 20 |
class Bar { }; |
| 21 |
struct Foo { |
| 22 |
template <typename P> requires std::is_base_of_v<Bar, P> |
| 23 |
Foo(P const&); |
| 24 |
}; |
| 25 |
template <typename P> |
| 26 |
Foo fun(P const& arg) { |
| 27 |
(bool)arg; // { dg-error "" } |
| 28 |
return Foo {arg}; |
| 29 |
} |
| 30 |
int main() { |
| 31 |
fun(Bar{}); |
| 32 |
return 0; |
| 33 |
} |