Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/spaceship-friend1.C

raw
1 // P2085, separate definition of defaulted comparisons
2 // { dg-do compile { target c++20 } }
3
4 namespace X {
5
6 struct A {
7 int i;
8 friend constexpr bool operator==(const A&,const A&);
9 };
10
11 inline constexpr bool operator==(const A&,const A&)=default;
12
13 static_assert (A() == A());
14
15 }
16
17 namespace Y {
18
19 struct A {
20 int i;
21 // friend bool operator==(const A&,const A&);
22 };
23
24 inline bool operator==(const A&,const A&)=default; // { dg-error "not a friend" }
25
26 }