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
14 struct strong_ordering {
16 constexpr operator int() const { return n; }
17 static const strong_ordering equal, greater, less;
19 constexpr strong_ordering strong_ordering::equal = {0};
20 constexpr strong_ordering strong_ordering::greater = {1};
21 constexpr strong_ordering strong_ordering::less = {-1};
25 template <typename _Tp>
28 using value_type = _Tp;
32 constexpr bool has_value() const noexcept
34 return this->__engaged_;
37 constexpr const value_type& operator*() const& noexcept
42 optional(_Tp v) : __val_(v) {
48 concept __is_derived_from_optional = requires(const _Tp& __t) { []<class __Up>(const optional<__Up>&) {}(__t); };
50 template <class _Tp, class _Up>
51 requires(!__is_derived_from_optional<_Up>)
52 constexpr strong_ordering
53 operator<=>(const optional<_Tp>& __x, const _Up& __v) {
54 return __x.has_value() ? *__x <=> __v : strong_ordering::less;
62 export namespace std {
64 using std::operator<=>;
71 export namespace std {
73 using std::operator<=>;
82 // expected-no-diagnostics
85 std::optional<int> a(43);