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