aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/spaceship-friend1.C
blob: 24bbc74a2d19fdf240d94fef944aa42a9661816f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// P2085, separate definition of defaulted comparisons
// { dg-do compile { target c++20 } }

namespace X {

  struct A {
    int i;
    friend constexpr bool operator==(const A&,const A&);
  };

  inline constexpr bool operator==(const A&,const A&)=default;

  static_assert (A() == A());

}

namespace Y {

  struct A {
    int i;
    // friend bool operator==(const A&,const A&);
  };

  inline bool operator==(const A&,const A&)=default; // { dg-error "not a friend" }

}