xref: /llvm-project/libcxx/test/std/concepts/concepts.lang/concept.same/same_as.pass.cpp (revision d2baefae6846765eef6a6dd69d4fdf1082ce29ad)
1*24dd2d2fSChristopher Di Bella //===----------------------------------------------------------------------===//
2*24dd2d2fSChristopher Di Bella //
3*24dd2d2fSChristopher Di Bella // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*24dd2d2fSChristopher Di Bella // See https://llvm.org/LICENSE.txt for license information.
5*24dd2d2fSChristopher Di Bella // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*24dd2d2fSChristopher Di Bella //
7*24dd2d2fSChristopher Di Bella //===----------------------------------------------------------------------===//
8*24dd2d2fSChristopher Di Bella 
9*24dd2d2fSChristopher Di Bella // UNSUPPORTED: c++03, c++11, c++14, c++17
10*24dd2d2fSChristopher Di Bella 
11*24dd2d2fSChristopher Di Bella // template<class T, class U>
12*24dd2d2fSChristopher Di Bella // concept same_as;
13*24dd2d2fSChristopher Di Bella 
14*24dd2d2fSChristopher Di Bella #include <concepts>
15*24dd2d2fSChristopher Di Bella #include <type_traits>
16*24dd2d2fSChristopher Di Bella 
17*24dd2d2fSChristopher Di Bella struct S1 {};
18*24dd2d2fSChristopher Di Bella struct S2 {
19*24dd2d2fSChristopher Di Bella   int i;
20*24dd2d2fSChristopher Di Bella 
21*24dd2d2fSChristopher Di Bella   int& f();
22*24dd2d2fSChristopher Di Bella   double g(int x) const;
23*24dd2d2fSChristopher Di Bella };
24*24dd2d2fSChristopher Di Bella struct S3 {
25*24dd2d2fSChristopher Di Bella   int& r;
26*24dd2d2fSChristopher Di Bella };
27*24dd2d2fSChristopher Di Bella struct S4 {
28*24dd2d2fSChristopher Di Bella   int&& r;
29*24dd2d2fSChristopher Di Bella };
30*24dd2d2fSChristopher Di Bella struct S5 {
31*24dd2d2fSChristopher Di Bella   int* p;
32*24dd2d2fSChristopher Di Bella };
33*24dd2d2fSChristopher Di Bella 
34*24dd2d2fSChristopher Di Bella class C1 {};
35*24dd2d2fSChristopher Di Bella class C2 {
36*24dd2d2fSChristopher Di Bella   [[maybe_unused]] int i;
37*24dd2d2fSChristopher Di Bella };
38*24dd2d2fSChristopher Di Bella 
39*24dd2d2fSChristopher Di Bella class C3 {
40*24dd2d2fSChristopher Di Bella public:
41*24dd2d2fSChristopher Di Bella   int i;
42*24dd2d2fSChristopher Di Bella };
43*24dd2d2fSChristopher Di Bella 
44*24dd2d2fSChristopher Di Bella template <class T1, class T2 = T1>
45*24dd2d2fSChristopher Di Bella class C4 {
46*24dd2d2fSChristopher Di Bella   int t1;
47*24dd2d2fSChristopher Di Bella   int t2;
48*24dd2d2fSChristopher Di Bella };
49*24dd2d2fSChristopher Di Bella 
50*24dd2d2fSChristopher Di Bella template <class T1, class T2 = T1>
51*24dd2d2fSChristopher Di Bella class C5 {
52*24dd2d2fSChristopher Di Bella   [[maybe_unused]] T1 t1;
53*24dd2d2fSChristopher Di Bella 
54*24dd2d2fSChristopher Di Bella public:
55*24dd2d2fSChristopher Di Bella   T2 t2;
56*24dd2d2fSChristopher Di Bella };
57*24dd2d2fSChristopher Di Bella 
58*24dd2d2fSChristopher Di Bella template <class T1, class T2 = T1>
59*24dd2d2fSChristopher Di Bella class C6 {
60*24dd2d2fSChristopher Di Bella public:
61*24dd2d2fSChristopher Di Bella   [[maybe_unused]] T1 t1;
62*24dd2d2fSChristopher Di Bella   [[maybe_unused]] T2 t2;
63*24dd2d2fSChristopher Di Bella };
64*24dd2d2fSChristopher Di Bella 
65*24dd2d2fSChristopher Di Bella template <class T>
66*24dd2d2fSChristopher Di Bella struct identity {
67*24dd2d2fSChristopher Di Bella   using type = T;
68*24dd2d2fSChristopher Di Bella };
69*24dd2d2fSChristopher Di Bella 
70*24dd2d2fSChristopher Di Bella template <template <typename> class Modifier = identity>
CheckSameAs()71*24dd2d2fSChristopher Di Bella void CheckSameAs() {
72*24dd2d2fSChristopher Di Bella   static_assert(
73*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<int>::type, typename Modifier<int>::type>);
74*24dd2d2fSChristopher Di Bella   static_assert(
75*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<S1>::type, typename Modifier<S1>::type>);
76*24dd2d2fSChristopher Di Bella   static_assert(
77*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<S2>::type, typename Modifier<S2>::type>);
78*24dd2d2fSChristopher Di Bella   static_assert(
79*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<S3>::type, typename Modifier<S3>::type>);
80*24dd2d2fSChristopher Di Bella   static_assert(
81*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<S4>::type, typename Modifier<S4>::type>);
82*24dd2d2fSChristopher Di Bella   static_assert(
83*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<S5>::type, typename Modifier<S5>::type>);
84*24dd2d2fSChristopher Di Bella   static_assert(
85*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<C1>::type, typename Modifier<C1>::type>);
86*24dd2d2fSChristopher Di Bella   static_assert(
87*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<C2>::type, typename Modifier<C2>::type>);
88*24dd2d2fSChristopher Di Bella   static_assert(
89*24dd2d2fSChristopher Di Bella       std::same_as<typename Modifier<C3>::type, typename Modifier<C3>::type>);
90*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C4<int> >::type,
91*24dd2d2fSChristopher Di Bella                              typename Modifier<C4<int> >::type>);
92*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C4<int&> >::type,
93*24dd2d2fSChristopher Di Bella                              typename Modifier<C4<int&> >::type>);
94*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C4<int&&> >::type,
95*24dd2d2fSChristopher Di Bella                              typename Modifier<C4<int&&> >::type>);
96*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C5<int> >::type,
97*24dd2d2fSChristopher Di Bella                              typename Modifier<C5<int> >::type>);
98*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C5<int&> >::type,
99*24dd2d2fSChristopher Di Bella                              typename Modifier<C5<int&> >::type>);
100*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C5<int&&> >::type,
101*24dd2d2fSChristopher Di Bella                              typename Modifier<C5<int&&> >::type>);
102*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C6<int> >::type,
103*24dd2d2fSChristopher Di Bella                              typename Modifier<C6<int> >::type>);
104*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C6<int&> >::type,
105*24dd2d2fSChristopher Di Bella                              typename Modifier<C6<int&> >::type>);
106*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<C6<int&&> >::type,
107*24dd2d2fSChristopher Di Bella                              typename Modifier<C6<int&&> >::type>);
108*24dd2d2fSChristopher Di Bella 
109*24dd2d2fSChristopher Di Bella   static_assert(std::same_as<typename Modifier<void>::type,
110*24dd2d2fSChristopher Di Bella                              typename Modifier<void>::type>);
111*24dd2d2fSChristopher Di Bella }
112*24dd2d2fSChristopher Di Bella 
113*24dd2d2fSChristopher Di Bella template <template <typename> class Modifier1,
114*24dd2d2fSChristopher Di Bella           template <typename> class Modifier2>
CheckNotSameAs()115*24dd2d2fSChristopher Di Bella void CheckNotSameAs() {
116*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<int>::type,
117*24dd2d2fSChristopher Di Bella                               typename Modifier2<int>::type>);
118*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<S1>::type,
119*24dd2d2fSChristopher Di Bella                               typename Modifier2<S1>::type>);
120*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<S2>::type,
121*24dd2d2fSChristopher Di Bella                               typename Modifier2<S2>::type>);
122*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<S3>::type,
123*24dd2d2fSChristopher Di Bella                               typename Modifier2<S3>::type>);
124*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<S4>::type,
125*24dd2d2fSChristopher Di Bella                               typename Modifier2<S4>::type>);
126*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<S5>::type,
127*24dd2d2fSChristopher Di Bella                               typename Modifier2<S5>::type>);
128*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C1>::type,
129*24dd2d2fSChristopher Di Bella                               typename Modifier2<C1>::type>);
130*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C2>::type,
131*24dd2d2fSChristopher Di Bella                               typename Modifier2<C2>::type>);
132*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C3>::type,
133*24dd2d2fSChristopher Di Bella                               typename Modifier2<C3>::type>);
134*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C4<int> >::type,
135*24dd2d2fSChristopher Di Bella                               typename Modifier2<C4<int> >::type>);
136*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C4<int&> >::type,
137*24dd2d2fSChristopher Di Bella                               typename Modifier2<C4<int&> >::type>);
138*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C4<int&&> >::type,
139*24dd2d2fSChristopher Di Bella                               typename Modifier2<C4<int&&> >::type>);
140*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C5<int> >::type,
141*24dd2d2fSChristopher Di Bella                               typename Modifier2<C5<int> >::type>);
142*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C5<int&> >::type,
143*24dd2d2fSChristopher Di Bella                               typename Modifier2<C5<int&> >::type>);
144*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C5<int&&> >::type,
145*24dd2d2fSChristopher Di Bella                               typename Modifier2<C5<int&&> >::type>);
146*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C6<int> >::type,
147*24dd2d2fSChristopher Di Bella                               typename Modifier2<C6<int> >::type>);
148*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C6<int&> >::type,
149*24dd2d2fSChristopher Di Bella                               typename Modifier2<C6<int&> >::type>);
150*24dd2d2fSChristopher Di Bella   static_assert(!std::same_as<typename Modifier1<C6<int&&> >::type,
151*24dd2d2fSChristopher Di Bella                               typename Modifier2<C6<int&&> >::type>);
152*24dd2d2fSChristopher Di Bella }
153*24dd2d2fSChristopher Di Bella 
154*24dd2d2fSChristopher Di Bella // Checks subsumption works as intended
155*24dd2d2fSChristopher Di Bella template <class T, class U>
156*24dd2d2fSChristopher Di Bella requires std::same_as<T, U> void SubsumptionTest();
157*24dd2d2fSChristopher Di Bella 
158*24dd2d2fSChristopher Di Bella // clang-format off
159*24dd2d2fSChristopher Di Bella template <class T, class U>
160*24dd2d2fSChristopher Di Bella requires std::same_as<U, T> && true // NOLINT(readability-simplify-boolean-expr)
161*24dd2d2fSChristopher Di Bella int SubsumptionTest();
162*24dd2d2fSChristopher Di Bella // clang-format on
163*24dd2d2fSChristopher Di Bella 
164*24dd2d2fSChristopher Di Bella static_assert(std::same_as<int, decltype(SubsumptionTest<int, int>())>);
165*24dd2d2fSChristopher Di Bella static_assert(std::same_as<int, decltype(SubsumptionTest<void, void>())>);
166*24dd2d2fSChristopher Di Bella static_assert(
167*24dd2d2fSChristopher Di Bella     std::same_as<int, decltype(SubsumptionTest<int (*)(), int (*)()>())>);
168*24dd2d2fSChristopher Di Bella static_assert(
169*24dd2d2fSChristopher Di Bella     std::same_as<
170*24dd2d2fSChristopher Di Bella         int, decltype(SubsumptionTest<double (&)(int), double (&)(int)>())>);
171*24dd2d2fSChristopher Di Bella static_assert(
172*24dd2d2fSChristopher Di Bella     std::same_as<int, decltype(SubsumptionTest<int S2::*, int S2::*>())>);
173*24dd2d2fSChristopher Di Bella static_assert(
174*24dd2d2fSChristopher Di Bella     std::same_as<int,
175*24dd2d2fSChristopher Di Bella                  decltype(SubsumptionTest<int& (S2::*)(), int& (S2::*)()>())>);
176*24dd2d2fSChristopher Di Bella 
main(int,char **)177*24dd2d2fSChristopher Di Bella int main(int, char**) {
178*24dd2d2fSChristopher Di Bella   { // Checks std::same_as<T, T> is true
179*24dd2d2fSChristopher Di Bella     CheckSameAs();
180*24dd2d2fSChristopher Di Bella 
181*24dd2d2fSChristopher Di Bella     // Checks std::same_as<T&, T&> is true
182*24dd2d2fSChristopher Di Bella     CheckSameAs<std::add_lvalue_reference>();
183*24dd2d2fSChristopher Di Bella 
184*24dd2d2fSChristopher Di Bella     // Checks std::same_as<T&&, T&&> is true
185*24dd2d2fSChristopher Di Bella     CheckSameAs<std::add_rvalue_reference>();
186*24dd2d2fSChristopher Di Bella 
187*24dd2d2fSChristopher Di Bella     // Checks std::same_as<const T, const T> is true
188*24dd2d2fSChristopher Di Bella     CheckSameAs<std::add_const>();
189*24dd2d2fSChristopher Di Bella 
190*24dd2d2fSChristopher Di Bella     // Checks std::same_as<volatile T, volatile T> is true
191*24dd2d2fSChristopher Di Bella     CheckSameAs<std::add_volatile>();
192*24dd2d2fSChristopher Di Bella 
193*24dd2d2fSChristopher Di Bella     // Checks std::same_as<const volatile T, const volatile T> is true
194*24dd2d2fSChristopher Di Bella     CheckSameAs<std::add_cv>();
195*24dd2d2fSChristopher Di Bella 
196*24dd2d2fSChristopher Di Bella     // Checks std::same_as<T*, T*> is true
197*24dd2d2fSChristopher Di Bella     CheckSameAs<std::add_pointer>();
198*24dd2d2fSChristopher Di Bella 
199*24dd2d2fSChristopher Di Bella     // Checks concrete types are identical
200*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<void, void>);
201*24dd2d2fSChristopher Di Bella 
202*24dd2d2fSChristopher Di Bella     using Void = void;
203*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<void, Void>);
204*24dd2d2fSChristopher Di Bella 
205*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<int[1], int[1]>);
206*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<int[2], int[2]>);
207*24dd2d2fSChristopher Di Bella 
208*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<int (*)(), int (*)()>);
209*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<void (&)(), void (&)()>);
210*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<S1& (*)(S1), S1& (*)(S1)>);
211*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<C1& (&)(S1, int), C1& (&)(S1, int)>);
212*24dd2d2fSChristopher Di Bella 
213*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<int S2::*, int S2::*>);
214*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<double S2::*, double S2::*>);
215*24dd2d2fSChristopher Di Bella 
216*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<int& (S2::*)(), int& (S2::*)()>);
217*24dd2d2fSChristopher Di Bella     static_assert(std::same_as<double& (S2::*)(int), double& (S2::*)(int)>);
218*24dd2d2fSChristopher Di Bella   }
219*24dd2d2fSChristopher Di Bella 
220*24dd2d2fSChristopher Di Bella   { // Checks that `T` and `T&` are distinct types
221*24dd2d2fSChristopher Di Bella     CheckNotSameAs<identity, std::add_lvalue_reference>();
222*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_lvalue_reference, identity>();
223*24dd2d2fSChristopher Di Bella 
224*24dd2d2fSChristopher Di Bella     // Checks that `T` and `T&&` are distinct types
225*24dd2d2fSChristopher Di Bella     CheckNotSameAs<identity, std::add_rvalue_reference>();
226*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_rvalue_reference, identity>();
227*24dd2d2fSChristopher Di Bella 
228*24dd2d2fSChristopher Di Bella     // Checks that `T` and `const T` are distinct types
229*24dd2d2fSChristopher Di Bella     CheckNotSameAs<identity, std::add_const>();
230*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_const, identity>();
231*24dd2d2fSChristopher Di Bella 
232*24dd2d2fSChristopher Di Bella     // Checks that `T` and `volatile T` are distinct types
233*24dd2d2fSChristopher Di Bella     CheckNotSameAs<identity, std::add_volatile>();
234*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_volatile, identity>();
235*24dd2d2fSChristopher Di Bella 
236*24dd2d2fSChristopher Di Bella     // Checks that `T` and `const volatile T` are distinct types
237*24dd2d2fSChristopher Di Bella     CheckNotSameAs<identity, std::add_cv>();
238*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_cv, identity>();
239*24dd2d2fSChristopher Di Bella 
240*24dd2d2fSChristopher Di Bella     // Checks that `const T` and `volatile T` are distinct types
241*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_const, std::add_volatile>();
242*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_volatile, std::add_const>();
243*24dd2d2fSChristopher Di Bella 
244*24dd2d2fSChristopher Di Bella     // Checks that `const T` and `const volatile T` are distinct types
245*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_const, std::add_cv>();
246*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_cv, std::add_const>();
247*24dd2d2fSChristopher Di Bella 
248*24dd2d2fSChristopher Di Bella     // Checks that `volatile T` and `const volatile T` are distinct types
249*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_volatile, std::add_cv>();
250*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_cv, std::add_volatile>();
251*24dd2d2fSChristopher Di Bella 
252*24dd2d2fSChristopher Di Bella     // Checks `T&` and `T&&` are distinct types
253*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_lvalue_reference, std::add_rvalue_reference>();
254*24dd2d2fSChristopher Di Bella     CheckNotSameAs<std::add_rvalue_reference, std::add_lvalue_reference>();
255*24dd2d2fSChristopher Di Bella   }
256*24dd2d2fSChristopher Di Bella 
257*24dd2d2fSChristopher Di Bella   { // Checks different type names are distinct types
258*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<S1, C1>);
259*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<C4<int>, C5<int> >);
260*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<C4<int>, C5<int> >);
261*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<C5<int, double>, C5<double, int> >);
262*24dd2d2fSChristopher Di Bella 
263*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&, const int&>);
264*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&, volatile int&>);
265*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&, const volatile int&>);
266*24dd2d2fSChristopher Di Bella 
267*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&&, const int&>);
268*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&&, volatile int&>);
269*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&&, const volatile int&>);
270*24dd2d2fSChristopher Di Bella 
271*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&, const int&&>);
272*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&, volatile int&&>);
273*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&, const volatile int&&>);
274*24dd2d2fSChristopher Di Bella 
275*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&&, const int&&>);
276*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&&, volatile int&&>);
277*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int&&, const volatile int&&>);
278*24dd2d2fSChristopher Di Bella 
279*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<void, int>);
280*24dd2d2fSChristopher Di Bella 
281*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int[1], int[2]>);
282*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<double[1], int[2]>);
283*24dd2d2fSChristopher Di Bella 
284*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int* (*)(), const int* (*)()>);
285*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<void (&)(), void (&)(S1)>);
286*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<S1 (*)(S1), S1& (*)(S1)>);
287*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<C3 (&)(int), C1& (&)(S1, int)>);
288*24dd2d2fSChristopher Di Bella 
289*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int S2::*, double S2::*>);
290*24dd2d2fSChristopher Di Bella 
291*24dd2d2fSChristopher Di Bella     static_assert(!std::same_as<int& (S2::*)(), double& (S2::*)(int)>);
292*24dd2d2fSChristopher Di Bella   }
293*24dd2d2fSChristopher Di Bella 
294*24dd2d2fSChristopher Di Bella   return 0;
295*24dd2d2fSChristopher Di Bella }
296