Created on 2018-01-11.00:00:00 last changed 46 months ago
Proposed resolution:
This wording is relative to N4849.
Modify [time.duration.cons] as indicated:
template<class Rep2> constexpr explicit duration(const Rep2& r);-1- Constraints: is_convertible_v<const Rep2&, rep> is true and
[…] -2- Postconditions: count() == static_cast<rep>(r).
(1.1) — treat_as_floating_point_v<rep> is true or
(1.2) — treat_as_floating_point_v<Rep2> is false.
Modify [time.duration.nonmember] as indicated:
template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator*(const duration<Rep1, Period>& d, const Rep2& s);-4- Constraints: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true.
[…]template<class Rep1, class Rep2, class Period> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator*(const Rep1& s, const duration<Rep2, Period>& d);-6- Constraints: is_convertible_v<const Rep1&, common_type_t<Rep1, Rep2>> is true.
[…]template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator/(const duration<Rep1, Period>& d, const Rep2& s);[…]-8- Constraints: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true and Rep2 is not a specialization of duration.
template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator%(const duration<Rep1, Period>& d, const Rep2& s);-12- Constraints: is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true and Rep2 is not a specialization of duration.
[…]
[ 2020-02 Status to Immediate on Thursday night in Prague. ]
[ 2020-02-13, Prague ]
Rebase to most recent working draft
[ 2018-12-05 Jonathan provides new wording ]
In San Diego Geoff noticed that the current WP does not use CR. Jonathan provides new wording consistent with the editorial changes that removed CR.
Previous resolution [SUPERSEDED]:Previous resolution [SUPERSEDED]:This wording is relative to N4713.
Modify [time.duration.cons] as indicated:
template<class Rep2> constexpr explicit duration(const Rep2& r);-1- Remarks: This constructor shall not participate in overload resolution unless is_convertible_v<const Rep2&, rep> is true
Rep2 is implicitly convertible to repand[…] -2- Effects: Constructs an object of type duration. -3- Postconditions: count() == static_cast<rep>(r).
(1.1) — treat_as_floating_point_v<rep> is true or
(1.2) — treat_as_floating_point_v<Rep2> is false.
Modify [time.duration.nonmember] as indicated:
template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator*(const duration<Rep1, Period>& d, const Rep2& s);-4- Remarks: This operator shall not participate in overload resolution unless is_convertible_v<const Rep2&, CR(Rep1, Rep2)> is true
[…]Rep2 is implicitly convertible to CR(Rep1, Rep2).template<class Rep1, class Rep2, class Period> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator*(const Rep1& s, const duration<Rep2, Period>& d);-6- Remarks: This operator shall not participate in overload resolution unless is_convertible_v<const Rep1&, CR(Rep1, Rep2)> is true
[…]Rep1 is implicitly convertible to CR(Rep1, Rep2).template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator/(const duration<Rep1, Period>& d, const Rep2& s);[…]-8- Remarks: This operator shall not participate in overload resolution unless is_convertible_v<const Rep2&, CR(Rep1, Rep2)> is true
Rep2 is implicitly convertible to CR(Rep1, Rep2)and Rep2 is not a specialization of duration.template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator%(const duration<Rep1, Period>& d, const Rep2& s);-11- Remarks: This operator shall not participate in overload resolution unless is_convertible_v<const Rep2&, CR(Rep1, Rep2)> is true
[…]Rep2 is implicitly convertible to CR(Rep1, Rep2)and Rep2 is not a specialization of duration.
This wording is relative to N4791.
Modify [time.duration.cons] as indicated:
template<class Rep2> constexpr explicit duration(const Rep2& r);-1- Remarks: This constructor shall not participate in overload resolution unless is_convertible_v<const Rep2&, rep> is true
Rep2 is implicitly convertible to repand[…] -2- Effects: Constructs an object of type duration. -3- Postconditions: count() == static_cast<rep>(r).
(1.1) — treat_as_floating_point_v<rep> is true or
(1.2) — treat_as_floating_point_v<Rep2> is false.
Modify [time.duration.nonmember] as indicated:
template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator*(const duration<Rep1, Period>& d, const Rep2& s);-4- Remarks: This operator shall not participate in overload resolution unless is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true
[…]Rep2 is implicitly convertible to common_type_t<Rep1, Rep2>.template<class Rep1, class Rep2, class Period> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator*(const Rep1& s, const duration<Rep2, Period>& d);-6- Remarks: This operator shall not participate in overload resolution unless is_convertible_v<const Rep1&, common_type_t<Rep1, Rep2>> is true
[…]Rep1 is implicitly convertible to common_type_t<Rep1, Rep2>.template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator/(const duration<Rep1, Period>& d, const Rep2& s);[…]-8- Remarks: This operator shall not participate in overload resolution unless is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true
Rep2 is implicitly convertible to common_type_t<Rep1, Rep2>and Rep2 is not a specialization of duration.template<class Rep1, class Period, class Rep2> constexpr duration<common_type_t<Rep1, Rep2>, Period> operator%(const duration<Rep1, Period>& d, const Rep2& s);-11- Remarks: This operator shall not participate in overload resolution unless is_convertible_v<const Rep2&, common_type_t<Rep1, Rep2>> is true
[…]Rep2 is implicitly convertible to common_type_t<Rep1, Rep2>and Rep2 is not a specialization of duration.
[ 2018-11 San Diego Thursday night issue processing ]
Jonathan to provide updated wording; the underlying text has changed.
[ 2018-06 Rapperswil Thursday issues processing ]
P3; Status to Open
The converting constructor in std::chrono::duration is currently specified as ([time.duration.cons] p1):
template<class Rep2> constexpr explicit duration(const Rep2& r);Remarks: This constructor shall not participate in overload resolution unless Rep2 is implicitly convertible to rep and […]
But the parameter is of type Rep2 const, so we should check that Rep2 const is implicitly convertible to rep, not just Rep2. This means that for a type like:
struct X { operator int64_t() /* not const */; };
std::is_constructible_v<std::chrono::seconds, X> is true, but actual construction will fail to compile.
Further analysis of sub-clause [time.duration] revealed similar specification problems in some other functions.History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2020-02-24 16:02:59 | admin | set | status: immediate -> wp |
2020-02-14 09:37:04 | admin | set | messages: + msg11104 |
2020-02-14 09:37:04 | admin | set | status: open -> immediate |
2020-02-13 18:57:08 | admin | set | messages: + msg11080 |
2018-12-04 22:42:34 | admin | set | messages: + msg10247 |
2018-11-12 05:21:03 | admin | set | messages: + msg10215 |
2018-06-12 04:35:59 | admin | set | messages: + msg9910 |
2018-06-12 04:35:59 | admin | set | status: new -> open |
2018-01-23 19:57:43 | admin | set | messages: + msg9622 |
2018-01-23 19:57:43 | admin | set | messages: + msg9621 |
2018-01-23 19:57:43 | admin | restored | |
2018-01-14 13:56:30 | admin | retired | |
2018-01-14 13:56:30 | admin | set | messages: - msg9604, msg9605 |
2018-01-13 19:29:23 | admin | set | messages: + msg9605 |
2018-01-11 00:00:00 | admin | create |