1 // RUN: %clang_cc1 -pedantic-errors -std=c++2a -emit-pch  %s -o %t
2 // RUN: %clang_cc1 -pedantic-errors -std=c++2a -include-pch %t -verify %s
3 // RUN: %clang_cc1 -pedantic-errors -std=c++2a -include-pch %t -emit-llvm %s -o -
4 
5 
6 #ifndef HEADER
7 #define HEADER
8 
9 #include "Inputs/std-compare.h"
foo()10 constexpr auto foo() {
11   return (42 <=> 101);
12 }
13 
bar(int x)14 inline auto bar(int x) {
15   return (1 <=> x);
16 }
17 
18 struct X {
19   int a;
operator <=>(const X & x,const X & y)20   friend constexpr std::strong_ordering operator<=>(const X &x, const X &y) {
21     return x.a <=> y.a;
22   }
23 };
baz(int x)24 constexpr auto baz(int x) {
25   return X{3} < X{x};
26 }
27 
28 #else
29 
30 // expected-no-diagnostics
31 
32 static_assert(foo() < 0);
33 
bar2(int x)34 auto bar2(int x) {
35   return bar(x);
36 }
37 
38 static_assert(!baz(3));
39 static_assert(baz(4));
40 
41 #endif
42