http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60711
Bug ID: 60711 Summary: basic_ostringstream,basic_ostream,u16string,char16_t do not work together Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: jmichae3 at yahoo dot com Created attachment 32487 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32487&action=edit .ii file #include <ostream> #include <sstream> #include <vector> #include <string> #include <ios> #include <initializer_list> #include <uchar.h> #include <wchar.h> namespace std { typedef std::vector<std::u16string> Vu16S; typedef std::basic_ostringstream<char16_t,std::char_traits<char16_t> > uostringstream; typedef std::basic_ostringstream<char32_t,std::char_traits<char32_t> > u32ostringstream; typedef std::basic_ostream<char16_t,std::char_traits<char16_t> > uostream; typedef std::basic_ostream<char32_t,std::char_traits<char32_t> > u32ostream; /* In file included from ostream2a.cpp:2:0: f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\x86_64-w64-mingw32\include\c++\ostream:384:7: error: 'std::basic_ostream<_CharT, _Traits>:: basic_ostream() [with _CharT = char16_t; _Traits = std::char_traits<char16_t>]' is protected basic_ostream() ^ ostream2a.cpp:16:10: error: within this context uostream ucout; ^ In file included from ostream2a.cpp:2:0: f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\x86_64-w64-mingw32\include\c++\ostream:384:7: error: 'std::basic_ostream<_CharT, _Traits>:: basic_ostream() [with _CharT = char32_t; _Traits = std::char_traits<char32_t>]' is protected basic_ostream() ^ ostream2a.cpp:17:12: error: within this context u32ostream u32cout; ^ ostream2a.cpp:27:1: error: expected '}' at end of input } ^ I saw this later on and this matched my implementation (but I did not know about dropping the 16): http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2035.pdf but this doesn't work, even apparently with the microsoft compiler. something funny with the standard? so: what is wrong in the first error? I don't understand why something is protected. somebody said something about fstream containing the implementation of ostream in gcc (not sure if this is stil true). apparently, msvc++ has this problem too. seems like something I ought to be able to do simply, but it just breaks. not sure why this is protected. there is no wstring_convert. I grepped for it. */ -municode doesn't help.