aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/spaceship-eq3.C
blob: 246839f1f955f473e6758cd6da3d2626a1ffaa94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// { dg-do compile { target c++20 } }

struct A {
  bool operator==(const A&) const;
};

struct D
{
  A i;
  bool operator==(const D& x) const = default; // { dg-error "A::operator==" "" { target c++20_down } }
  bool operator!=(const D& z) const = default; // { dg-error "D::operator==" "" { target c++20_down } }
// { dg-error "called" "" { target { c++23 && implicit_constexpr } } .-1 }
};

constexpr D d{A()};
static_assert (d == d);		// { dg-error "constant|constexpr" }
static_assert (!(d != d));	// { dg-error "constant|constexpr" }