Result of year_month arithmetic with months is ambiguous
Tomasz Kamiński

Created on 2019-06-16.00:00:00 last changed 39 months ago


Date: 2019-07-23.15:26:26

Proposed resolution:

This wording is relative to N4810.

  1. Modify [time.cal.ym.nonmembers] as indicated:

    constexpr year_month operator+(const year_month& ym, const months& dm) noexcept;

    -3- Returns: A year_month value z such that z.ok() && z - ym == dm is true.

    Complexity: 𝒪(1) with respect to the value of dm.

Date: 2019-08-23.18:06:54

[ 2019-07 Issue Prioritization ]

Status to Tentatively Ready after five positive votes on the reflector.

Date: 2019-06-15.00:00:00

[ 2019-06-24; LWG discussion ]

During discussions on the LWG reflector there was a preference to add "is true" at the end of the modified Returns: element. This additional edit has been applied to Tomasz' original wording below.

Date: 2019-06-16.00:00:00

The current specification of the addition of year_month and months does not define a unique result value.

To illustrate, both year(2019)/month(1) and year(2018)/month(13) are valid results of year(2018)/month(12) + months(1) addition, according to the spec in [time.cal.ym.nonmembers].

Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2019-11-19 14:48:30adminsetstatus: voting -> wp
2019-10-07 02:48:00adminsetstatus: ready -> voting
2019-07-23 15:26:26adminsetmessages: + msg10503
2019-07-23 15:26:26adminsetstatus: new -> ready
2019-06-24 18:17:02adminsetmessages: + msg10466
2019-06-16 09:46:32adminsetmessages: + msg10450
2019-06-16 00:00:00admincreate