aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/spaceship-weak1.C
blob: 400d9931b6688eee0a8adf6eb62c28d613f3275b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// Test explicit weak_ordering.
// { dg-do compile { target c++20 } }

#include <compare>
struct A
{
  int i;
  std::weak_ordering operator<=> (const A&) const = default;
};

constexpr A a = { 42 };
constexpr auto c = a <=> a;
static_assert (std::same_as <decltype (c), const std::weak_ordering>);
static_assert (std::is_eq (c));