This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/52114] New: SFINAE out the rvalue iostream operators to give better error messages
- From: "b.r.longbons at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 03 Feb 2012 18:53:00 +0000
- Subject: [Bug libstdc++/52114] New: SFINAE out the rvalue iostream operators to give better error messages
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52114
Bug #: 52114
Summary: SFINAE out the rvalue iostream operators to give
better error messages
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: b.r.longbons@gmail.com
Created attachment 26566
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26566
Use SFINAE in delayed return type to make sure there's an lvalue version
Currently, if there is no stream insertion/extraction operator defined for a
class, it tries to use the template that takes an rvalue istream or ostream and
anything on the right.
Actual Result:
error: cannot bind âstd::ostream {aka std::basic_ostream<char>}â lvalue to
âstd::basic_ostream<char>&&â
/usr/include/c++/4.6/ostream:581:5: error: initializing argument 1 of
âstd::basic_ostream<_CharT, _Traits>&
std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT
= char, _Traits = std::char_traits<char>, _Tp = Foo]â
Expected Result:
error: no match for âoperator<<â in âstd::cout << Foo()â
note: candidates are:
Note that this patch is not safe to apply to 4.6 because of bug 51878