HomePhabricator

[libc++] Avoid UB in year_month_day_last::day() for incorrect months

Authored by ldionne on Jun 9 2020, 9:31 AM.

Description

[libc++] Avoid UB in year_month_day_last::day() for incorrect months

This effectively implements the resolution of LWG3231, which mandates
that calling year_month_day_last::day() on an invalid year_month_day_last
is unspecified behavior. Before this change, it was undefined behavior.

Differential Revision: https://reviews.llvm.org/D81477