diff options
Diffstat (limited to 'test/PCH/cxx2a-compare.cpp')
-rw-r--r-- | test/PCH/cxx2a-compare.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/PCH/cxx2a-compare.cpp b/test/PCH/cxx2a-compare.cpp index 9ad368d88f..019544d28c 100644 --- a/test/PCH/cxx2a-compare.cpp +++ b/test/PCH/cxx2a-compare.cpp @@ -15,6 +15,16 @@ inline auto bar(int x) { return (1 <=> x); } +struct X { + int a; + friend constexpr std::strong_ordering operator<=>(const X &x, const X &y) { + return x.a <=> y.a; + } +}; +constexpr auto baz(int x) { + return X{3} < X{x}; +} + #else // expected-no-diagnostics @@ -25,4 +35,7 @@ auto bar2(int x) { return bar(x); } +static_assert(!baz(3)); +static_assert(baz(4)); + #endif |