tomaszkam / date

A date and time library based on the C++11/14/17 <chrono> header
Other
0 stars 0 forks source link

[LWG3209] Expression in year::ok() returns clause is ill-formed #29

Closed tomaszkam closed 5 years ago

tomaszkam commented 5 years ago

Original comment:

year::ok() does "min() <= y­ && y­ <= max()", which compares a short against two years. It should either use *this rather than y_, or cast min()/max() to int.

tomaszkam commented 5 years ago

Decided to pick third option: compare with y_ member of min() and max(), which is equivalent to cast.

tomaszkam commented 5 years ago

Discussion: The expression in Returns element of year::ok in [time.cal.year.members] p18: min() <= y­ && y­ <= max() is ill-formed, as it attempts to compare short (type of y_ member) with year (type of year::min() and year::max()).

Proposed wording: Change the specification of year::ok function in [time.cal.year.members] as follows:

constexpr bool ok() const noexcept;

Returns: min().y <= y­ && y­ <= max().y