Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/is-corresponding-member4.C

raw
1 // P0466R5
2 // { dg-do compile { target c++20 } }
3
4 namespace std
5 {
6 template <class S1, class S2, class M1, class M2>
7 constexpr bool
8 is_corresponding_member (M1 S1::*m1, M2 S2::*m2) noexcept
9 {
10 return __builtin_is_corresponding_member (m1, m2); // { dg-error "invalid use of incomplete type 'struct B'" }
11 }
12 }
13
14 struct A { int a; };
15 struct B;
16 constexpr int B::*n = nullptr;
17 constexpr auto a = std::is_corresponding_member (&A::a, n); // { dg-message "in .constexpr. expansion of" }
18 constexpr auto b = std::is_corresponding_member (n, &A::a); // { dg-message "in .constexpr. expansion of" }
19
20 void
21 foo (int B::*m)
22 {
23 std::is_corresponding_member (&A::a, m);
24 std::is_corresponding_member (m, &A::a);
25 }