| 1 |
// RUN: %clang_cc1 -std=c++2a -verify -Wno-defaulted-function-deleted -include %s %s |
| 2 |
// |
| 3 |
// RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t.pch |
| 4 |
// RUN: %clang_cc1 -std=c++2a -include-pch %t.pch %s -verify |
| 5 |
// |
| 6 |
// RUN: %clang_cc1 -std=c++2a -emit-pch -fpch-instantiate-templates %s -o %t.pch |
| 7 |
// RUN: %clang_cc1 -std=c++2a -include-pch %t.pch %s -verify |
| 8 |
|
| 9 |
// expected-no-diagnostics |
| 10 |
|
| 11 |
#ifndef INCLUDED |
| 12 |
#define INCLUDED |
| 13 |
|
| 14 |
namespace 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. |
| 26 |
namespace 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 |
#else |
| 43 |
|
| 44 |
namespace 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 |
#endif |