1 // RUN: rm -rf %t.mcp 2 // RUN: mkdir -p %t 3 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 5 // 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 -fexperimental-new-constant-interpreter 6 7 struct CC { CC(...); }; 8 a()9void a() { void(0 <=> 0); } // expected-error {{include <compare>}} 10 11 struct A { 12 CC operator<=>(const A&) const = default; // expected-error {{include <compare>}} 13 }; 14 auto va = A() <=> A(); // expected-note {{required here}} 15 16 #pragma clang module import compare.other 17 18 // expected-note@std-compare.h:* 2+{{not reachable}} 19 b()20void b() { void(0 <=> 0); } // expected-error 1+{{definition of 'strong_ordering' must be imported from module 'compare.cmp' before it is required}} 21 22 struct B { 23 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 }; 25 auto vb = B() <=> B(); // expected-note {{required here}} 26 27 #pragma clang module import compare.cmp 28 c()29void c() { void(0 <=> 0); } 30 31 struct C { 32 CC operator<=>(const C&) const = default; 33 }; 34 auto vc = C() <=> C(); 35 36 37 #pragma clang module build compare2 38 module compare2 {} 39 #pragma clang module contents 40 #pragma clang module begin compare2 41 #include "std-compare.h" 42 #pragma clang module end 43 #pragma clang module endbuild 44 45 #pragma clang module import compare2 46 47 void g() { void(0.0 <=> 0.0); } 48