Debian Codegraph @

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

raw
1 // P0466R5
2 // { dg-do run { 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);
11 }
12 }
13
14 struct A { int a; };
15 struct B { const int b; };
16 struct C { int a; unsigned int b; int f; A c; int : 0; int d; double e; };
17 struct D { const int x; unsigned int y; int g; B z; int u; double w; };
18 struct E { int a; [[no_unique_address]] int b; };
19 struct F { int c; const int d; };
20 struct G { double a; int b; double c; };
21 struct H { const volatile double d; int e : 16; double f; };
22 struct I { const double g; int h : 15; const double i; };
23 struct J : public A {};
24 struct K {};
25 struct L : public K, public B {};
26 union U { int a; };
27 struct V { void foo () {}; };
28 struct W { int a; private: int b; public: int c; };
29 struct Z : public A, public B {};
30
31 int
32 main ()
33 {
34 auto t1 = &A::a;
35 auto t2 = &A::a;
36 if (!std::is_corresponding_member (t1, t2))
37 __builtin_abort ();
38 auto t3 = &A::a;
39 auto t4 = &B::b;
40 if (!std::is_corresponding_member (t3, t4))
41 __builtin_abort ();
42 auto t5 = &C::a;
43 auto t6 = &D::x;
44 if (!std::is_corresponding_member (t5, t6))
45 __builtin_abort ();
46 auto t9 = &C::b;
47 auto t10 = &D::y;
48 if (!std::is_corresponding_member (t9, t10))
49 __builtin_abort ();
50 auto t11 = &C::f;
51 auto t12 = &D::g;
52 if (!std::is_corresponding_member (t11, t12))
53 __builtin_abort ();
54 auto t13 = &C::c;
55 auto t14 = &D::z;
56 if (!std::is_corresponding_member (t13, t14))
57 __builtin_abort ();
58 auto t15 = &C::d;
59 auto t16 = &D::u;
60 if (std::is_corresponding_member (t15, t16))
61 __builtin_abort ();
62 auto t17 = &C::e;
63 auto t18 = &D::w;
64 if (std::is_corresponding_member (t17, t18))
65 __builtin_abort ();
66 auto t19 = &C::f;
67 auto t20 = &D::x;
68 if (std::is_corresponding_member (t19, t20))
69 __builtin_abort ();
70 auto t21 = &C::a;
71 auto t22 = &D::g;
72 if (std::is_corresponding_member (t21, t22))
73 __builtin_abort ();
74 auto t23 = &E::a;
75 auto t24 = &F::c;
76 if (!std::is_corresponding_member (t23, t24))
77 __builtin_abort ();
78 auto t25 = &E::b;
79 auto t26 = &F::d;
80 if (std::is_corresponding_member (t25, t26))
81 __builtin_abort ();
82 auto t27 = &G::a;
83 auto t28 = &H::d;
84 if (!std::is_corresponding_member (t27, t28))
85 __builtin_abort ();
86 auto t29 = &G::c;
87 auto t30 = &H::f;
88 if (std::is_corresponding_member (t29, t30))
89 __builtin_abort ();
90 auto t31 = &H::d;
91 auto t32 = &I::g;
92 if (!std::is_corresponding_member (t31, t32))
93 __builtin_abort ();
94 auto t33 = &H::f;
95 auto t34 = &I::i;
96 if (std::is_corresponding_member (t33, t34))
97 __builtin_abort ();
98 auto t35 = &J::a;
99 auto t36 = &B::b;
100 if (!std::is_corresponding_member (t35, t36))
101 __builtin_abort ();
102 int J::*t37 = &J::a;
103 const int B::*t38 = &B::b;
104 if (!std::is_corresponding_member (t37, t38))
105 __builtin_abort ();
106 auto t39 = &J::a;
107 auto t40 = &L::b;
108 if (!std::is_corresponding_member (t39, t40))
109 __builtin_abort ();
110 int J::*t41 = &J::a;
111 const int L::*t42 = &L::b;
112 if (!std::is_corresponding_member (t41, t42))
113 __builtin_abort ();
114 auto t43 = &L::b;
115 auto t44 = &B::b;
116 if (!std::is_corresponding_member (t43, t44))
117 __builtin_abort ();
118 const int L::*t45 = &L::b;
119 const int B::*t46 = &B::b;
120 if (!std::is_corresponding_member (t45, t46))
121 __builtin_abort ();
122 auto t47 = &U::a;
123 auto t48 = &U::a;
124 if (std::is_corresponding_member (t47, t48))
125 __builtin_abort ();
126 auto t49 = &A::a;
127 auto t50 = (int A::*) nullptr;
128 if (std::is_corresponding_member (t49, t50))
129 __builtin_abort ();
130 auto t51 = (int A::*) nullptr;
131 auto t52 = &A::a;
132 if (std::is_corresponding_member (t51, t52))
133 __builtin_abort ();
134 auto t53 = (int A::*) nullptr;
135 auto t54 = (int A::*) nullptr;
136 if (std::is_corresponding_member (t53, t54))
137 __builtin_abort ();
138 auto t55 = &V::foo;
139 auto t56 = &V::foo;
140 if (std::is_corresponding_member (t55, t56))
141 __builtin_abort ();
142 auto t57 = &W::a;
143 auto t58 = &W::a;
144 if (std::is_corresponding_member (t57, t58))
145 __builtin_abort ();
146 auto t59 = &W::c;
147 auto t60 = &W::c;
148 if (std::is_corresponding_member (t59, t60))
149 __builtin_abort ();
150 auto t61 = &Z::a;
151 auto t62 = &Z::b;
152 if (!std::is_corresponding_member (t61, t62))
153 __builtin_abort ();
154 int Z::*t63 = &Z::a;
155 const int Z::*t64 = &Z::b;
156 if (std::is_corresponding_member (t63, t64))
157 __builtin_abort ();
158 }