Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaCXX / compare-modules-cxx2a.cpp
blob470464427efd9cbe9a27a75650bc392f7906809a
1 // RUN: rm -rf %t.mcp
2 // RUN: mkdir -p %t
4 // RUN: %clang_cc1 -triple x86_64-apple-darwin -fcxx-exceptions -verify -std=c++2a -fmodules -fmodules-cache-path=%t.mcp -I%S/Inputs %s -fno-modules-error-recovery -fmodule-map-file=%S/Inputs/compare.modulemap
6 struct CC { CC(...); };
8 void a() { void(0 <=> 0); } // expected-error {{include <compare>}}
10 struct A {
11 CC operator<=>(const A&) const = default; // expected-error {{include <compare>}}
13 auto va = A() <=> A(); // expected-note {{required here}}
15 #pragma clang module import compare.other
17 // expected-note@std-compare.h:* 2+{{not reachable}}
19 void b() { void(0 <=> 0); } // expected-error 1+{{definition of 'strong_ordering' must be imported from module 'compare.cmp' before it is required}}
21 struct B {
22 CC operator<=>(const B&) const = default; // expected-error 1+{{definition of 'strong_ordering' must be imported from module 'compare.cmp' before it is required}}
24 auto vb = B() <=> B(); // expected-note {{required here}}
26 #pragma clang module import compare.cmp
28 void c() { void(0 <=> 0); }
30 struct C {
31 CC operator<=>(const C&) const = default;
33 auto vc = C() <=> C();
36 #pragma clang module build compare2
37 module compare2 {}
38 #pragma clang module contents
39 #pragma clang module begin compare2
40 #include "std-compare.h"
41 #pragma clang module end
42 #pragma clang module endbuild
44 #pragma clang module import compare2
46 void g() { void(0.0 <=> 0.0); }