150
|
1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -fcxx-exceptions -verify -std=c++2a -fmodules -I%S/Inputs %s -fno-modules-error-recovery
|
|
2
|
|
3 #pragma clang module build compare
|
|
4 module compare {
|
|
5 explicit module cmp {}
|
|
6 explicit module other {}
|
|
7 }
|
|
8 #pragma clang module contents
|
|
9 #pragma clang module begin compare.cmp
|
|
10 #include "std-compare.h"
|
|
11 #pragma clang module end
|
|
12 #pragma clang module endbuild
|
|
13
|
|
14 struct CC { CC(...); };
|
|
15
|
|
16 void a() { void(0 <=> 0); } // expected-error {{include <compare>}}
|
|
17
|
|
18 struct A {
|
|
19 CC operator<=>(const A&) const = default; // expected-error {{include <compare>}}
|
|
20 };
|
|
21 auto va = A() <=> A(); // expected-note {{required here}}
|
|
22
|
|
23 #pragma clang module import compare.other
|
|
24
|
173
|
25 // expected-note@std-compare.h:* 2+{{not reachable}}
|
150
|
26
|
173
|
27 void b() { void(0 <=> 0); } // expected-error 1+{{missing '#include "std-compare.h"'; 'strong_ordering' must be defined}}
|
150
|
28
|
|
29 struct B {
|
173
|
30 CC operator<=>(const B&) const = default; // expected-error 1+{{missing '#include "std-compare.h"'; 'strong_ordering' must be defined}}
|
150
|
31 };
|
|
32 auto vb = B() <=> B(); // expected-note {{required here}}
|
|
33
|
|
34 #pragma clang module import compare.cmp
|
|
35
|
|
36 void c() { void(0 <=> 0); }
|
|
37
|
|
38 struct C {
|
|
39 CC operator<=>(const C&) const = default;
|
|
40 };
|
|
41 auto vc = C() <=> C();
|
|
42
|
|
43
|
|
44 #pragma clang module build compare2
|
|
45 module compare2 {}
|
|
46 #pragma clang module contents
|
|
47 #pragma clang module begin compare2
|
|
48 #include "std-compare.h"
|
|
49 #pragma clang module end
|
|
50 #pragma clang module endbuild
|
|
51
|
|
52 #pragma clang module import compare2
|
|
53
|
|
54 void g() { void(0.0 <=> 0.0); }
|