Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/spaceship-synth-neg1.C

raw
1 // { dg-do compile { target c++20 } }
2
3 #include <compare>
4
5 template <class T>
6 struct D
7 {
8 T i;
9 auto operator<=>(D) const = default; // { dg-error "defaulted member" }
10 bool operator==(D) const = default; // { dg-error "defaulted member" }
11 bool operator!=(D) const = default; // { dg-error "defaulted member" }
12 bool operator<(D) const = default; // { dg-error "defaulted member" }
13 bool operator<=(D) const = default; // { dg-error "defaulted member" }
14 bool operator>(D) const = default; // { dg-error "defaulted member" }
15 bool operator>=(D) const = default; // { dg-error "defaulted member" }
16 };
17
18 template <class T>
19 struct E
20 {
21 T i;
22 friend auto operator<=>(const E&, E) = default; // { dg-error "not both" }
23 friend bool operator==(const E&, E) = default; // { dg-error "not both" }
24 friend bool operator!=(const E&, E) = default; // { dg-error "not both" }
25 friend bool operator<(E, const E&) = default; // { dg-error "not both" }
26 friend bool operator<=(E, const E&) = default; // { dg-error "not both" }
27 friend bool operator>(E, const E&) = default; // { dg-error "not both" }
28 friend bool operator>=(E, const E&) = default; // { dg-error "not both" }
29 };