This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.

3125. duration streaming precondition should be a SFINAE condition

Section: 29.5.11 [time.duration.io] Status: Resolved Submitter: Johel Ernesto Guerrero Peña Opened: 2018-06-23 Last modified: 2020-11-09

Priority: 2

View all other issues in [time.duration.io].

View all issues with Resolved status.

Discussion:

29.5.11 [time.duration.io]/1 states:

template<class charT, class traits, class Rep, class Period>
  basic_ostream<charT, traits>&
    operator<<(basic_ostream<charT, traits>& os, const duration<Rep, Period>& d);

Requires: Rep is an integral type whose integer conversion rank (6.8.6 [conv.rank]) is greater than or equal to that of short, or a floating point type. charT is char or wchar_t.

I think the intention was to make this a compile-time error, since all the information to make it so is available at compile-time. But the wording doesn't suggest that.

[2018-06-29; Daniel comments]

The wording will be significantly simplified by the application of the new Library element Constraints: introduced by P0788R3 and available with the post-Rapperswil working draft.

[2018-07-20 Priority set to 2 after reflector discussion. NAD and P0 were also mentioned.]

[2018-08-23 Batavia Issues processing]

Marshall to talk to Howard about his intent. Status to Open

Previous resolution [SUPERSEDED]:

This wording is relative to N4750.

Change 29.5.11 [time.duration.io] as indicated:

[Drafting note: The suggested wording changes include the insertion of two bullets into the existing running text to improve clarification of the logic arm of the "unless"].

template<class charT, class traits, class Rep, class Period>
  basic_ostream<charT, traits>&
    operator<<(basic_ostream<charT, traits>& os, const duration<Rep, Period>& d);

-1- RequiresRemarks: This function shall not participate in overload resolution unless:

  • Rep is an integral type whose integer conversion rank (6.8.6 [conv.rank]) is greater than or equal to that of short, or a floating point type., and

  • charT is char or wchar_t

[…]

[2020-02-13, Prague]

Will be resolved by LWG 3317.

[2020-11-09 Resolved for C++20. Status changed: Tentatively Resolved → Resolved.]

Proposed resolution: