annotate clang/test/PCH/cxx2a-defaulted-comparison.cpp @ 221:79ff65ed7e25

LLVM12 Original
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 15 Jun 2021 19:15:29 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
1 // RUN: %clang_cc1 -std=c++2a -verify -Wno-defaulted-function-deleted -include %s %s
150
anatofuz
parents:
diff changeset
2 //
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t.pch
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 -std=c++2a -include-pch %t.pch %s -verify
221
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
5 //
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
6 // RUN: %clang_cc1 -std=c++2a -emit-pch -fpch-instantiate-templates %s -o %t.pch
79ff65ed7e25 LLVM12 Original
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 150
diff changeset
7 // RUN: %clang_cc1 -std=c++2a -include-pch %t.pch %s -verify
150
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 // expected-no-diagnostics
anatofuz
parents:
diff changeset
10
anatofuz
parents:
diff changeset
11 #ifndef INCLUDED
anatofuz
parents:
diff changeset
12 #define INCLUDED
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 namespace std {
anatofuz
parents:
diff changeset
15 struct strong_ordering {
anatofuz
parents:
diff changeset
16 int n;
anatofuz
parents:
diff changeset
17 constexpr operator int() const { return n; }
anatofuz
parents:
diff changeset
18 static const strong_ordering equal, greater, less;
anatofuz
parents:
diff changeset
19 };
anatofuz
parents:
diff changeset
20 constexpr strong_ordering strong_ordering::equal = {0};
anatofuz
parents:
diff changeset
21 constexpr strong_ordering strong_ordering::greater = {1};
anatofuz
parents:
diff changeset
22 constexpr strong_ordering strong_ordering::less = {-1};
anatofuz
parents:
diff changeset
23 }
anatofuz
parents:
diff changeset
24
anatofuz
parents:
diff changeset
25 // Ensure that we can round-trip DefaultedFunctionInfo through an AST file.
anatofuz
parents:
diff changeset
26 namespace LookupContext {
anatofuz
parents:
diff changeset
27 struct A {};
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 namespace N {
anatofuz
parents:
diff changeset
30 template <typename T> auto f() {
anatofuz
parents:
diff changeset
31 bool operator==(const T &, const T &);
anatofuz
parents:
diff changeset
32 bool operator<(const T &, const T &);
anatofuz
parents:
diff changeset
33 struct B {
anatofuz
parents:
diff changeset
34 T a;
anatofuz
parents:
diff changeset
35 std::strong_ordering operator<=>(const B &) const = default;
anatofuz
parents:
diff changeset
36 };
anatofuz
parents:
diff changeset
37 return B();
anatofuz
parents:
diff changeset
38 }
anatofuz
parents:
diff changeset
39 }
anatofuz
parents:
diff changeset
40 }
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 #else
anatofuz
parents:
diff changeset
43
anatofuz
parents:
diff changeset
44 namespace LookupContext {
anatofuz
parents:
diff changeset
45 namespace M {
anatofuz
parents:
diff changeset
46 bool operator<=>(const A &, const A &) = delete;
anatofuz
parents:
diff changeset
47 bool operator==(const A &, const A &) = delete;
anatofuz
parents:
diff changeset
48 bool operator<(const A &, const A &) = delete;
anatofuz
parents:
diff changeset
49 bool cmp = N::f<A>() < N::f<A>();
anatofuz
parents:
diff changeset
50 }
anatofuz
parents:
diff changeset
51 }
anatofuz
parents:
diff changeset
52
anatofuz
parents:
diff changeset
53 #endif