Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libcxx/docs/Status/Cxx2cIssues.csv
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@
"`LWG4106 <https://wg21.link/LWG4106>`__","``basic_format_args`` should not be default-constructible","2024-06 (St. Louis)","|Complete|","19.0","|format|"
"","","","","",""
"`LWG3343 <https://wg21.link/LWG3343>`__","Ordering of calls to ``unlock()`` and ``notify_all()`` in Effects element of ``notify_all_at_thread_exit()`` should be reversed","Not Adopted Yet","|Complete|","16.0",""
"`LWG4139 <https://wg21.link/LWG4139>`__","§[time.zone.leap] recursive constraint in <=>","Not Adopted Yet","|Complete|","20.0",""
"","","","","",""
131 changes: 68 additions & 63 deletions libcxx/include/__chrono/leap_second.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,70 +50,75 @@ class leap_second {
private:
sys_seconds __date_;
seconds __value_;
};

_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const leap_second& __x, const leap_second& __y) {
return __x.date() == __y.date();
}

_LIBCPP_HIDE_FROM_ABI inline constexpr strong_ordering operator<=>(const leap_second& __x, const leap_second& __y) {
return __x.date() <=> __y.date();
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const leap_second& __x, const sys_time<_Duration>& __y) {
return __x.date() == __y;
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const leap_second& __x, const sys_time<_Duration>& __y) {
return __x.date() < __y;
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator<(const sys_time<_Duration>& __x, const leap_second& __y) {
return __x < __y.date();
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const leap_second& __x, const sys_time<_Duration>& __y) {
return __y < __x;
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator>(const sys_time<_Duration>& __x, const leap_second& __y) {
return __y < __x;
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const leap_second& __x, const sys_time<_Duration>& __y) {
return !(__y < __x);
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator<=(const sys_time<_Duration>& __x, const leap_second& __y) {
return !(__y < __x);
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const leap_second& __x, const sys_time<_Duration>& __y) {
return !(__x < __y);
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(const sys_time<_Duration>& __x, const leap_second& __y) {
return !(__x < __y);
}

# ifndef _LIBCPP_COMPILER_GCC
// This requirement cause a compilation loop in GCC-13 and running out of memory.
// TODO TZDB Test whether GCC-14 fixes this.
template <class _Duration>
requires three_way_comparable_with<sys_seconds, sys_time<_Duration>>
_LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(const leap_second& __x, const sys_time<_Duration>& __y) {
return __x.date() <=> __y;
}
# endif
// The function
// template<class Duration>
// requires three_way_comparable_with<sys_seconds, sys_time<Duration>>
// constexpr auto operator<=>(const leap_second& x, const sys_time<Duration>& y) noexcept;
//
// Has constraints that are recursive (LWG4139). The proposed resolution is
// to make the funcion a hidden friend. For consistency make this change for
// all comparison functions.

_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const leap_second& __x, const leap_second& __y) {
return __x.date() == __y.date();
}

_LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering operator<=>(const leap_second& __x, const leap_second& __y) {
return __x.date() <=> __y.date();
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const leap_second& __x, const sys_time<_Duration>& __y) {
return __x.date() == __y;
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const leap_second& __x, const sys_time<_Duration>& __y) {
return __x.date() < __y;
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const sys_time<_Duration>& __x, const leap_second& __y) {
return __x < __y.date();
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const leap_second& __x, const sys_time<_Duration>& __y) {
return __y < __x;
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const sys_time<_Duration>& __x, const leap_second& __y) {
return __y < __x;
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const leap_second& __x, const sys_time<_Duration>& __y) {
return !(__y < __x);
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const sys_time<_Duration>& __x, const leap_second& __y) {
return !(__y < __x);
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const leap_second& __x, const sys_time<_Duration>& __y) {
return !(__x < __y);
}

template <class _Duration>
_LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const sys_time<_Duration>& __x, const leap_second& __y) {
return !(__x < __y);
}

template <class _Duration>
requires three_way_comparable_with<sys_seconds, sys_time<_Duration>>
_LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const leap_second& __x, const sys_time<_Duration>& __y) {
return __x.date() <=> __y;
}
};

} // namespace chrono

Expand Down