Debian Codegraph @

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

raw
1 // { dg-do compile { target c++20 } }
2
3 struct A {
4 bool operator==(const A&) const;
5 };
6
7 struct D
8 {
9 A i;
10 bool operator==(const D& x) const = default; // { dg-error "A::operator==" "" { target c++20_down } }
11 bool operator!=(const D& z) const = default; // { dg-error "D::operator==" "" { target c++20_down } }
12 // { dg-error "called" "" { target { c++23 && implicit_constexpr } } .-1 }
13 };
14
15 constexpr D d{A()};
16 static_assert (d == d); // { dg-error "constant|constexpr" }
17 static_assert (!(d != d)); // { dg-error "constant|constexpr" }