Debian Codegraph @

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

raw
1 // PR c++/99429
2 // { dg-do compile { target c++20 } }
3
4 namespace std {
5 struct strong_ordering {
6 int _v;
7 constexpr strong_ordering (int v) :_v(v) {}
8 constexpr operator int (void) const { return _v; }
9 static const strong_ordering less;
10 static const strong_ordering equal;
11 static const strong_ordering greater;
12 };
13 constexpr strong_ordering strong_ordering::less = -1;
14 constexpr strong_ordering strong_ordering::equal = 0;
15 constexpr strong_ordering strong_ordering::greater = 1;
16 }
17
18 template <unsigned long N>
19 struct duration {
20 static constexpr const long period = N;
21 constexpr duration (void) = default;
22 constexpr duration (const duration& d) = default;
23 constexpr bool operator== (const duration& d) const = default;
24 constexpr bool operator<=> (const duration& d) const = default;
25 long _d;
26 };
27
28 using nanoseconds = duration<1>;
29 using microseconds = duration<nanoseconds::period * 1000>;