3235. parse manipulator without abbreviation is not callable

Section: 30.13 [time.parse] Status: C++20 Submitter: Tomasz Kamiński Opened: 2019-07-10 Last modified: 2021-02-25

Priority: 0

View other active issues in [time.parse].

View all other issues in [time.parse].

View all issues with C++20 status.

Discussion:

The parse overload that does not accept the abbreviation but does accept an offset, because the expression in the Remarks: clause:

from_stream(declval<basic_istream<charT, traits>*>(), fmt.c_str(), tp, nullptr, &offset)

is not valid. This is caused by deduction failure for the basic_string<charT, traits, Alloc>* from nullptr (see this link):

[2019-08-17 Issue Prioritization]

Status to Tentatively Ready and priority to 0 after six positive votes on the reflector.

Proposed resolution:

This wording is relative to N4830.

[Drafting note: As a drive-by fix the Remarks element is also converted to a Constraints element.]

  1. Modify 30.13 [time.parse] as indicated:

    template<class charT, class traits, class Alloc, class Parsable>
      unspecified
        parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp,
              minutes& offset);
    

    -6- RemarksConstraints: This function shall not participate in overload resolution unlessThe expression

    from_stream(declval<basic_istream<charT, traits>&>(), fmt.c_str(), tp, 
      declval<basic_string<charT, traits, Alloc>*>()nullptr, &offset)
    

    is a validwell-formed expressionwhen treated as an unevaluated operand.

    -7- Returns: A manipulator that, when extracted from a basic_istream<charT, traits> is, calls from_stream(is, fmt.c_str(), tp, static_cast<basic_string<charT, traits, Alloc>*>(nullptr), &offset).