aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/is-pointer-interconvertible-with-class6.C
blob: 4b6801c41da61ebfdac1222e4671b59b6e42a5a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// P0466R5
// { dg-do compile { target c++20 } }

namespace std
{
template <class S, class M>
constexpr bool
is_pointer_interconvertible_with_class (M S::*m) noexcept
{
  return __builtin_is_pointer_interconvertible_with_class (m);
}
}

struct A { int a; };

double A::*a = nullptr;
constexpr double A::*b = nullptr;
constexpr auto c = std::is_pointer_interconvertible_with_class (a);	// { dg-error "is not usable in a constant expression" }
constexpr auto d = std::is_pointer_interconvertible_with_class (b);