aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg1.C
blob: 6c35f70ea6cebf6f0c9356a66f5af8aee372113e (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
27
28
29
// { dg-do compile { target c++20 } }

#include <compare>

template <class T>
struct D
{
  T i;
  auto operator<=>(D) const = default; // { dg-error "defaulted member" }
  bool operator==(D) const = default; // { dg-error "defaulted member" }
  bool operator!=(D) const = default; // { dg-error "defaulted member" }
  bool operator<(D) const = default; // { dg-error "defaulted member" }
  bool operator<=(D) const = default; // { dg-error "defaulted member" }
  bool operator>(D) const = default; // { dg-error "defaulted member" }
  bool operator>=(D) const = default; // { dg-error "defaulted member" }
};

template <class T>
struct E
{
  T i;
  friend auto operator<=>(const E&, E) = default; // { dg-error "not both" }
  friend bool operator==(const E&, E) = default; // { dg-error "not both" }
  friend bool operator!=(const E&, E) = default; // { dg-error "not both" }
  friend bool operator<(E, const E&) = default; // { dg-error "not both" }
  friend bool operator<=(E, const E&) = default; // { dg-error "not both" }
  friend bool operator>(E, const E&) = default; // { dg-error "not both" }
  friend bool operator>=(E, const E&) = default; // { dg-error "not both" }
};