[libc++] Avoid UB in year_month_day_last::day() for incorrect months
authorLouis Dionne <ldionne@apple.com>
Tue, 9 Jun 2020 16:31:12 +0000 (12:31 -0400)
committerLouis Dionne <ldionne@apple.com>
Tue, 9 Jun 2020 17:43:13 +0000 (13:43 -0400)
commit1f48f8f6e289d3ae14d28ad9bd000ef5ba209fc0
tree5b1549ceb821f0a5869a8d8eda3f1d04ce4b04ad
parent2c8afe1298e5f471a5736757b1cd2a708dd91ec9
[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
libcxx/include/chrono