3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++23 %t/a.cppm -emit-module-interface -o %t/m-a.pcm
6 // RUN: %clang_cc1 -std=c++23 %t/b.cppm -emit-module-interface -o %t/m-b.pcm
7 // RUN: %clang_cc1 -std=c++23 %t/m.cppm -emit-module-interface -o %t/m.pcm \
8 // RUN: -fprebuilt-module-path=%t
9 // RUN: %clang_cc1 -std=c++23 %t/pr63544.cpp -fprebuilt-module-path=%t -fsyntax-only -verify
11 // Test again with reduced BMI.
14 // RUN: split-file %s %t
16 // RUN: %clang_cc1 -std=c++23 %t/a.cppm -emit-reduced-module-interface -o %t/m-a.pcm
17 // RUN: %clang_cc1 -std=c++23 %t/b.cppm -emit-reduced-module-interface -o %t/m-b.pcm
18 // RUN: %clang_cc1 -std=c++23 %t/m.cppm -emit-reduced-module-interface -o %t/m.pcm \
19 // RUN: -fprebuilt-module-path=%t
20 // RUN: %clang_cc1 -std=c++23 %t/pr63544.cpp -fprebuilt-module-path=%t -fsyntax-only -verify
26 struct strong_ordering {
28 constexpr operator int() const { return n; }
29 static const strong_ordering equal, greater, less;
31 constexpr strong_ordering strong_ordering::equal = {0};
32 constexpr strong_ordering strong_ordering::greater = {1};
33 constexpr strong_ordering strong_ordering::less = {-1};
37 template <typename _Tp>
40 using value_type = _Tp;
44 constexpr bool has_value() const noexcept
46 return this->__engaged_;
49 constexpr const value_type& operator*() const& noexcept
54 optional(_Tp v) : __val_(v) {
60 concept __is_derived_from_optional = requires(const _Tp& __t) { []<class __Up>(const optional<__Up>&) {}(__t); };
62 template <class _Tp, class _Up>
63 requires(!__is_derived_from_optional<_Up>)
64 constexpr strong_ordering
65 operator<=>(const optional<_Tp>& __x, const _Up& __v) {
66 return __x.has_value() ? *__x <=> __v : strong_ordering::less;
74 export namespace std {
76 using std::operator<=>;
83 export namespace std {
85 using std::operator<=>;
94 // expected-no-diagnostics
97 std::optional<int> a(43);