[libc++][chrono] Fixes month inc and dec operations.
The operator++, operator++(int), operator--, and operator--(int) need to change the month to a valid value. The wording is specified in terms of operator+(const month& x, const months& y) noexcept; which has the correct behavior. The aforementioned operators instead used ++/-- on the internal value direction, resulting in incorrect behaviour. As a drive-by improve the unit tests: - use the typical constexpr test method - test whether the month is valid after the operations - format the tests Fixes: https://llvm.org/PR63912 Reviewed By: #libc, ldionne Differential Revision: https://reviews.llvm.org/D155504
Loading
Please sign in to comment