http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53683

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-15 
14:39:32 UTC ---
I don't know where you got that error message, I get a much simpler one.

Trunk shows:

u.cc: In function 'int main()':
u.cc:8:18: error: cannot bind 'std::ostream {aka std::basic_ostream<char>}'
lvalue to 'std::basic_ostream<char>&&'
     std::cout << test << std::endl;
                  ^
In file included from /home/jwakely/gcc/4.8/include/c++/4.8.0/iostream:40:0,
                 from u.cc:1:
/home/jwakely/gcc/4.8/include/c++/4.8.0/ostream:604: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 = std::basic_string<char16_t>]'
     operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
     ^

4.6 is similar but without the caret diagnostics and with a longer path to the
header.

That error isn't very helpful really, but is because the only match is the
"catch all" template for writing to rvalue streams, which can't be used because
std::cout is an lvalue:

  template<typename _CharT, typename _Traits, typename _Tp>
    inline basic_ostream<_CharT, _Traits>&
    operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)

But it's a lot better than the error you pasted, which I don't recognise.

I'll look into trying to add some constraints to the templates to improve
diagnostics.

Reply via email to