54 lines · cpp
1// RUN: %clang_cc1 -std=c++2a -verify -Wno-defaulted-function-deleted -include %s %s2//3// RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t.pch4// RUN: %clang_cc1 -std=c++2a -include-pch %t.pch %s -verify5//6// RUN: %clang_cc1 -std=c++2a -emit-pch -fpch-instantiate-templates %s -o %t.pch7// RUN: %clang_cc1 -std=c++2a -include-pch %t.pch %s -verify8 9// expected-no-diagnostics10 11#ifndef INCLUDED12#define INCLUDED13 14namespace std {15 struct strong_ordering {16 int n;17 constexpr operator int() const { return n; }18 static const strong_ordering equal, greater, less;19 };20 constexpr strong_ordering strong_ordering::equal = {0};21 constexpr strong_ordering strong_ordering::greater = {1};22 constexpr strong_ordering strong_ordering::less = {-1};23}24 25// Ensure that we can round-trip DefaultedOrDeletedInfo through an AST file.26namespace LookupContext {27 struct A {};28 29 namespace N {30 template <typename T> auto f() {31 bool operator==(const T &, const T &);32 bool operator<(const T &, const T &);33 struct B {34 T a;35 std::strong_ordering operator<=>(const B &) const = default;36 };37 return B();38 }39 }40}41 42#else43 44namespace LookupContext {45 namespace M {46 bool operator<=>(const A &, const A &) = delete;47 bool operator==(const A &, const A &) = delete;48 bool operator<(const A &, const A &) = delete;49 bool cmp = N::f<A>() < N::f<A>();50 }51}52 53#endif54