This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.
Section: 31.7.6.6 [ostream.rvalue], 31.7.5.6 [istream.rvalue] Status: C++17 Submitter: Robert Haberlach Opened: 2015-09-08 Last modified: 2017-07-30
Priority: 3
View all other issues in [ostream.rvalue].
View all issues with C++17 status.
Discussion:
The rvalue stream insertion and extraction operators should be constrained to not participate in overload resolution unless the expression they evaluate is well-formed. Programming code that tests the validity of stream insertions (or extractions) using SFINAE can result in false positives, as the present declarations accept virtually any right-hand side argument. Moreover, there is no need for pollution of the candidate set with ill-formed specializations.
[2016-08 - Chicago]
Thurs AM: Moved to Tentatively Ready
Proposed resolution:
This wording is relative to N4527.
Modify 31.7.6.6 [ostream.rvalue] as indicated:
template <class charT, class traits, class T> basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>&& os, const T& x);-1- Effects: os << x
-2- Returns: os -?- Remarks: This function shall not participate in overload resolution unless the expression os << x is well-formed.
Modify 31.7.5.6 [istream.rvalue] as indicated:
template <class charT, class traits, class T> basic_istream<charT, traits>& operator>>(basic_istream<charT, traits>&& is, T& x);-1- Effects: is >> x
-2- Returns: is -?- Remarks: This function shall not participate in overload resolution unless the expression is >> x is well-formed.