| 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_layout_compatible; |
| 14 |
|
| 15 |
template<typename T, typename U> |
| 16 |
struct is_layout_compatible |
| 17 |
: public integral_constant <bool, __is_layout_compatible (T, U)> |
| 18 |
{ |
| 19 |
}; |
| 20 |
|
| 21 |
template <typename T, typename U> |
| 22 |
inline constexpr bool is_layout_compatible_v = __is_layout_compatible (T, U); |
| 23 |
} |
| 24 |
// { dg-error "invalid use of incomplete type 'struct W'" "" { target *-*-* } .-2 } |
| 25 |
// { dg-error "invalid use of incomplete type 'struct \[XY]'" "" { target *-*-* } .-3 } |
| 26 |
// { dg-error "invalid use of incomplete type 'struct Z'" "" { target *-*-* } .-4 } |
| 27 |
|
| 28 |
struct W; |
| 29 |
struct X; |
| 30 |
struct Y; |
| 31 |
struct Z; |
| 32 |
struct A {}; |
| 33 |
|
| 34 |
auto a = std::is_layout_compatible_v<W, W>; |
| 35 |
auto b = std::is_layout_compatible_v<X, Y>; |
| 36 |
auto c = std::is_layout_compatible_v<A, Z>; |