Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speculatively implement LWG-4139 [time.zone.leap] recursive constraint in <=> #4902

Merged
merged 3 commits into from
Aug 25, 2024

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
Member

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
39 checks passed
@StephanTLavavej
Copy link
Member

Thanks for the preventative spaceship maintenance! 🔧 🛸 🪄

@frederick-vs-ja frederick-vs-ja deleted the lwg-4139 branch August 25, 2024 23:35
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