KEMBAR78
Speculatively implement LWG-4139 [time.zone.leap] recursive constraint in `<=>` by frederick-vs-ja · Pull Request #4902 · microsoft/STL · GitHub
Skip to content

Conversation

@frederick-vs-ja
Copy link
Contributor

LWG-4139 indicated constraint recursion in the current specification of the operator<=> for leap_second and sys_time, which is not yet revealed due to the bugs in MSVC and (old versions of) Clang.

Although the proposed resolution is not shown in the LWG issue, I think the necessary changes are clear enough - just moving the operator functions from the synopsis of <chrono> to that of std::chrono::leap_second and adding friend.

This has been done in libstdc++ years ago (gcc-mirror/gcc@1736bf5), and recently in libc++ via LLVM-104713.

@frederick-vs-ja frederick-vs-ja requested a review from a team as a code owner August 21, 2024 03:20
bool _Is_positive;
seconds _Elapsed_offset;
};
_NODISCARD friend constexpr bool operator==(const leap_second& _Left, const leap_second& _Right) noexcept {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change requested: I don't think we need a comment here to indicated speculative implementation of LWG-4139, despite that this is a fairly big change and that LWG hasn't yet signed off on a proposed resolution. LWG has demonstrated approval of the "make leap_second's operators hidden friends" approach, and both libc++ and libstdc++implement it, so I have no doubt this will be the eventual resolution of the issue.

@CaseyCarter CaseyCarter added the LWG Library Working Group issue label Aug 21, 2024
@StephanTLavavej StephanTLavavej added the chrono C++20 chrono label Aug 21, 2024
@StephanTLavavej StephanTLavavej self-assigned this Aug 21, 2024
@StephanTLavavej StephanTLavavej removed their assignment Aug 21, 2024
@StephanTLavavej StephanTLavavej self-assigned this Aug 25, 2024
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej changed the title Speculatively implement LWG-4139 §[time.zone.leap] recursive constraint in <=> Speculatively implement LWG-4139 [time.zone.leap] recursive constraint in <=> Aug 25, 2024
@StephanTLavavej StephanTLavavej merged commit c2ab040 into microsoft:main Aug 25, 2024
@StephanTLavavej
Copy link
Member

Thanks for the preventative spaceship maintenance! 🔧 🛸 🪄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chrono C++20 chrono LWG Library Working Group issue

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants