The function year_month_weekday::sys_days should work properly with a
weekday index of 0 per [time.cal.ymwd.members]/20. This adds a test for
this case.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D139126
assert( year_month_weekday{sd} == ymwd); // and back
}
+ {
+ // Index 0 returns 7 weekdays before index 1 and can't be round-tripped.
+ constexpr year_month_weekday ymwd{year{2000}, month{2}, weekday_indexed{std::chrono::Wednesday, 0}};
+ constexpr sys_days sd{ymwd};
+
+ static_assert(sd.time_since_epoch() == days{10957 + 25});
+ static_assert(year_month_weekday{sd} != ymwd); // and back fails
+ }
+
return 0;
}