Closed tomaszkam closed 5 years ago
I have little to no idea, why this change is required. It does not change the set of candidates, because std is already considered (due basic_istream). It is only related to precision of spec?
In from_stream
abbrev
is declared as a basic_string<charT, traits, Alloc>*
where all three template parameters are in deduced contexts. Passing nullptr
would cause deduction to fail.
@timsong-cpp
I have validated are from_stream
overload from the [time.syn] (http://eel.is/c++draft/time.syn) and in case of the the abbrev argument uses 3 template paramters charT
, traits
and Alloc
. Two of them (charT
, traits
) can be also deduced from basic_istream<charT, traits>
and the third is consistently specified with default argument class Alloc = allocator<charT>
.
As a consequence, no deduction from abbrev
argument is needed for this overload to works correctly, so I fail to see the issue here. Am I missing something?
If you use nullptr
, it's a straight-up mismatch and deduction fails right there. That you can deduce from the other arguments is irrelevant. See https://gcc.godbolt.org/z/ZIjfwV
Thanks, I think I understand the issue now.
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 https://gcc.godbolt.org/z/ZIjfwV):
Drafting note: The proposed wording purposelly does not change the Remarks note to Constrain, to preserve constiency in this section.
Proposed wording: Apply the following changes to [time.parse]:
template<class charT, class traits, class Alloc, class Parsable>
unspecified
parse(const basic_string<charT, traits, Alloc>& fmt, Parsable& tp,
minutes& offset);</code>
Remarks: This function shall not participate in overload resolution unless
from_stream(declval<basic_istream<charT, traits>&>(), fmt.c_str(), tp, declval<std::basic_string<CharT, traits, Alloc>*>()
is a valid expression.nullptr, &offset)
Returns: A manipulator that, when extracted from a basicistream<charT, traits> is
, calls fromstream(is, fmt.c_str(), tp, static_cast<basic_string<CharT, traits, Alloc>*>(nullptr), &offset)
.
Original comment: