This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++20 status.
Section: 126.96.36.199 [time.cal.wdidx.members] Status: C++20 Submitter: Howard Hinnant Opened: 2019-09-02 Last modified: 2021-02-25
View all issues with C++20 status.
On one hand, we say that if you try to construct a weekday_indexed with index 0, you get an unspecified index instead (188.8.131.52 [time.cal.wdidx.members]/p1),:
The values held are unspecified if !wd.ok() or index is not in the range [1, 5].
OTOH, we take pains to pin down year_month_weekday's conversion to sys_days when the index is zero (184.108.40.206 [time.cal.wdidx.members]/p19):
If index() is 0 the returned sys_days represents the date 7 days prior to the first weekday() of year()/month().
This is inconsistent. We should allow a slightly wider range (say, [0, 7], since you need at least 3 bits anyway to represent the 5 distinct valid values, and the 0 value referred to by 220.127.116.11 [time.cal.wdidx.members]/p19.
[2019-09-24 Issue Prioritization]
Status to Tentatively Ready and priority to 0 after six positive votes on the reflector.
This wording is relative to N4830.
Modify 18.104.22.168 [time.cal.wdidx.members] as indicated:
[Drafting note: As a drive-by fix a cleanup of "Constructs an object of type weekday_indexed" wording has been applied as well. ]
constexpr weekday_indexed(const chrono::weekday& wd, unsigned index) noexcept;
Constructs an object of type weekday_indexed by initializingwd_ with wd and index_ with index. The values held are unspecified if !wd.ok() or index is not in the range [ 1, 5].