Debian Codegraph @

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

raw
1 // Test explicit weak_ordering.
2 // { dg-do compile { target c++20 } }
3
4 #include <compare>
5 struct A
6 {
7 int i;
8 std::weak_ordering operator<=> (const A&) const = default;
9 };
10
11 constexpr A a = { 42 };
12 constexpr auto c = a <=> a;
13 static_assert (std::same_as <decltype (c), const std::weak_ordering>);
14 static_assert (std::is_eq (c));
15