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

--- Comment #2 from Rui Maciel <rui.maciel at gmail dot com> 2012-06-15 
13:08:01 UTC ---
(In reply to comment #1)
> (In reply to comment #0)
> > If, in the test program, std::u16string is replaced with std::u32string, the
> > program is successfully compiled.
> 
> That's surprising - it shouldn't work (and doesn't with G++ 4.7)
> 
> > It would be nice if std::cout also supported std::u16string objects.
> 
> std::cout is for char
> 
> You could use std::wstring_convert to convert a std::u16string to std::string
> for output (but GCC doesn't have wsring_convert yet, I plan to work on it next
> week.)

You are absolutely right.

I assumed that the definition of std::ostream also included definitions for
operator<< that supported definitions of basic_string<charT> with a charT other
than char, but it appears my assumptions were completely baseless.

In that case, is it possible to tweak gcc to return a friendlier error message?
 The current one is a bit long and frightening.  For example, is it possible
define an operator<< that throws a compiler error with any message similar to
"basic_ostream<charT,traits> doesn't provide an operator<< for
basic_string<some_other_T>"?  This sort of error message would be a whole lot
easier to digest.

Reply via email to