Created on 2020-01-30.00:00:00 last changed 45 months ago
Proposed resolution:
This wording is relative to N4849.
Modify [time.syn], header <chrono> synopsis, as indicated:
[Drafting note: The synopsis does provide an additional drive-by fix to eliminate the mismatch of the constexpr in declaration and prototype specification, but does not so for a similar mismatch of the exception-specifications of both declarations.]
namespace std { […] namespace chrono { […] template<three_way_comparable_with<sys_seconds>class Duration> requires three_way_comparable_with<sys_seconds, sys_time<Duration>> constexpr auto operator<=>(const leap& x, const sys_time<Duration>& y); […] } […] }
Modify [time.zone.leap.nonmembers] as indicated:
template<three_way_comparable_with<sys_seconds>class Duration> requires three_way_comparable_with<sys_seconds, sys_time<Duration>> constexpr auto operator<=>(const leap& x, const sys_time<Duration>& y) noexcept;-12- Returns: x.date() <=> y.
[ 2020-02 Moved to Immediate on Tuesday in Prague. ]
[ 2020-02-11, Prague; Daniel suggests alternative wording ]
During today's LWG discussion of this issue the observation was made that there also exists a mismatch regarding the noexcept specifier for both declarations, but for this second deviation a corresponding change does not seem to be a good drive-by fix candidate, because we have a function template here that allows supporting user-defined types, whose comparison may throw (Note that the corresponding operator<=> or other comparison function declarations of the duration and time_point templates are not specified as noexcept function templates). The revised wording below does therefore intentionally not change the currently existing noexcept-specifier mismatch, but a separate issue should instead be opened for the general noexcept-specifier mismatches for all comparison function templates of std::chrono::leap. Daniel has volunteered to take care for this issue.
[ 2020-02-10, Prague; Howard suggests alternative wording ]
The below shown alternative wording does more directly describe the constrained code (by comparing time_points), even though in the very end the code specifying the effects finally goes down to actually return x.date().time_since_epoch() <=> y.time_since_epoch() (thus comparing durations).
Previous resolution [SUPERSEDED]:This wording is relative to N4849.
Modify [time.syn], header <chrono> synopsis, as indicated:
The synopsis does provide an additional drive-by fix to eliminate the mismatch of the constexpr and noexcept in declaration and prototype specification.
namespace std { […] namespace chrono { […] template<three_way_comparable_with<sys_seconds>class Duration> requires three_way_comparable_with<sys_seconds, sys_time<Duration>> constexpr auto operator<=>(const leap& x, const sys_time<Duration>& y) noexcept; […] } […] }Modify [time.zone.leap.nonmembers] as indicated:
template<three_way_comparable_with<sys_seconds>class Duration> requires three_way_comparable_with<sys_seconds, sys_time<Duration>> constexpr auto operator<=>(const leap& x, const sys_time<Duration>& y) noexcept;-12- Returns: x.date() <=> y.
[ 2020-02 Prioritized as P1 Monday morning in Prague ]
Previous resolution [SUPERSEDED]:This wording is relative to N4849.
Modify [time.syn], header <chrono> synopsis, as indicated:
namespace std { […] namespace chrono { […] template<three_way_comparable_with<sys_seconds> Duration> auto operator<=>(const leap& x, const sys_time<Duration>& y); […] } […] }Modify [time.zone.leap.nonmembers] as indicated:
template<three_way_comparable_with<sys_seconds> Duration> constexpr auto operator<=>(const leap& x, const sys_time<Duration>& y) noexcept;-12- Returns: x.date() <=> y.
In N4849 [time.zone.leap.nonmembers]/12, the type template parameter Duration is constrained by three_way_comparable_with<sys_seconds>. However, since std::chrono::sys_seconds is a time point type and Duration must be a duration type, they can never be compared directly via operator<=>.
I guess that the actual intent is comparing Duration with the duration type of std::chrono::sys_seconds, i.e. std::chrono::seconds. And thus sys_seconds should be replaced with seconds here.History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2020-02-24 16:02:59 | admin | set | status: immediate -> wp |
2020-02-12 03:28:55 | admin | set | messages: + msg11043 |
2020-02-12 03:28:55 | admin | set | status: new -> immediate |
2020-02-11 17:23:05 | admin | set | messages: + msg11039 |
2020-02-10 20:28:06 | admin | set | messages: + msg11036 |
2020-02-10 19:13:13 | admin | set | messages: + msg11018 |
2020-02-01 13:41:23 | admin | set | messages: + msg10978 |
2020-01-30 00:00:00 | admin | create |