| 1 |
// P0466R5 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
namespace std |
| 5 |
{ |
| 6 |
template <typename T, T v> |
| 7 |
struct integral_constant |
| 8 |
{ |
| 9 |
static constexpr T value = v; |
| 10 |
}; |
| 11 |
|
| 12 |
template <typename, typename> |
| 13 |
struct is_pointer_interconvertible_base_of; |
| 14 |
|
| 15 |
template<typename T, typename U> |
| 16 |
struct is_pointer_interconvertible_base_of |
| 17 |
: public integral_constant <bool, __is_pointer_interconvertible_base_of (T, U)> |
| 18 |
{ |
| 19 |
}; |
| 20 |
|
| 21 |
template <typename T, typename U> |
| 22 |
inline constexpr bool is_pointer_interconvertible_base_of_v = __is_pointer_interconvertible_base_of (T, U); |
| 23 |
} |
| 24 |
|
| 25 |
struct A; |
| 26 |
struct B { int b; }; |
| 27 |
struct C : virtual B { int c; }; |
| 28 |
struct D {}; |
| 29 |
struct E {}; |
| 30 |
struct F : public B, D, E {}; |
| 31 |
struct G : public D, E { int g; }; |
| 32 |
struct H {}; |
| 33 |
struct I : public G, H {}; |
| 34 |
struct J { int j1; private: int j2; }; |
| 35 |
struct K : public J {}; |
| 36 |
union U { int a; }; |
| 37 |
|
| 38 |
static_assert (std::is_pointer_interconvertible_base_of<A, A>::value); |
| 39 |
static_assert (std::is_pointer_interconvertible_base_of_v<A, A>); |
| 40 |
static_assert (std::is_pointer_interconvertible_base_of_v<const A, volatile A>); |
| 41 |
static_assert (std::is_pointer_interconvertible_base_of_v<B, const B>); |
| 42 |
static_assert (std::is_pointer_interconvertible_base_of_v<C, const volatile C>); |
| 43 |
static_assert (!std::is_pointer_interconvertible_base_of_v<D, E>); |
| 44 |
static_assert (!std::is_pointer_interconvertible_base_of_v<D, const B>); |
| 45 |
static_assert (std::is_pointer_interconvertible_base_of_v<const B, F>); |
| 46 |
static_assert (std::is_pointer_interconvertible_base_of_v<D, const F>); |
| 47 |
static_assert (std::is_pointer_interconvertible_base_of_v<E, F>); |
| 48 |
static_assert (std::is_pointer_interconvertible_base_of_v<D, volatile G>); |
| 49 |
static_assert (std::is_pointer_interconvertible_base_of_v<const E, volatile G>); |
| 50 |
static_assert (std::is_pointer_interconvertible_base_of_v<D, I>); |
| 51 |
static_assert (std::is_pointer_interconvertible_base_of_v<const E, const I>); |
| 52 |
static_assert (std::is_pointer_interconvertible_base_of_v<G, I>); |
| 53 |
static_assert (std::is_pointer_interconvertible_base_of_v<H, volatile I>); |
| 54 |
static_assert (!std::is_pointer_interconvertible_base_of_v<volatile J, const K>); |
| 55 |
static_assert (!std::is_pointer_interconvertible_base_of_v<U, U>); |