public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together
@ 2014-03-30 16:15 jmichae3 at yahoo dot com
  2014-03-30 16:26 ` [Bug libstdc++/60711] " jmichae3 at yahoo dot com
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-03-30 16:15 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
@ 2014-03-30 16:26 ` jmichae3 at yahoo dot com
  2014-03-30 16:41 ` jmichae3 at yahoo dot com
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-03-30 16:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jim Michaels <jmichae3 at yahoo dot com> ---
oops! ignore the 
namespace std {
line and the error about missing } I was trying something earlier due to an
earlier error.
because basic_ostream() is protected in the include file ostream, I or anyone
else can't seem to do unicode strings with ostream and sstream?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
  2014-03-30 16:26 ` [Bug libstdc++/60711] " jmichae3 at yahoo dot com
@ 2014-03-30 16:41 ` jmichae3 at yahoo dot com
  2014-03-30 16:47 ` jmichae3 at yahoo dot com
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-03-30 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jim Michaels <jmichae3 at yahoo dot com> ---
Created attachment 32488
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32488&action=edit
corrected ostream2a.cpp source file

attached corrected source code.
nearly identical errors.
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:15: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:16:12: error: within this context
 u32ostream u32cout;
            ^


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
  2014-03-30 16:26 ` [Bug libstdc++/60711] " jmichae3 at yahoo dot com
  2014-03-30 16:41 ` jmichae3 at yahoo dot com
@ 2014-03-30 16:47 ` jmichae3 at yahoo dot com
  2014-03-30 17:29 ` glisse at gcc dot gnu.org
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-03-30 16:47 UTC (permalink / raw)
  To: gcc-bugs

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

Jim Michaels <jmichae3 at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #32487|0                           |1
        is obsolete|                            |

--- Comment #3 from Jim Michaels <jmichae3 at yahoo dot com> ---
Created attachment 32489
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32489&action=edit
replacement ostream2.ii

attached a replacement ostream2.ii
here is the full gcc -v output
Sun 03/30/2014 
9:23:35.40|D:\prj\df\df-3.19\win\tests|>"f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\bin\g++.exe"
-Wall -Wextra -v -sav
e-temps  -fno-strict-aliasing -fwrapv -lstdc++ -Wall -W -Wextra -Xlinker
-Map=ostream2a.map -std=c++11 -Ofast -o "ostream2a.exe" "ostream2a.cpp"
Using built-in specs.
COLLECT_GCC=f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.0/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: ../../../src/gcc-trunk/configure --host=x86_64-w64-mingw32
--build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64
--with-sysr
oot=/d/mingwtrunk/x86_64-trunk-win32-sjlj-rt_v4/mingw64
--with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared
--enable-static --enable-
targets=all --enable-multilib --enable-languages=c,c++,lto
--enable-libstdcxx-time=yes --enable-threads=win32 --enable-libgomp
--enable-lto --enable-graphite --
enable-checking=release --enable-fully-dynamic-string
--enable-version-specific-runtime-libs --enable-sjlj-exceptions
--disable-isl-version-check --disable-cloo
g-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug
--enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls
--disable-werror --d
isable-symvers --with-gnu-as --with-gnu-ld --with-arch-32=i686
--with-arch-64=nocona --with-tune-32=generic --with-tune-64=core2
--with-libiconv --with-system-z
lib --with-gmp=/d/mingwtrunk/prerequisites/x86_64-w64-mingw32-static
--with-mpfr=/d/mingwtrunk/prerequisites/x86_64-w64-mingw32-static
--with-mpc=/d/mingwtrunk/
prerequisites/x86_64-w64-mingw32-static
--with-isl=/d/mingwtrunk/prerequisites/x86_64-w64-mingw32-static
--with-cloog=/d/mingwtrunk/prerequisites/x86_64-w64-min
gw32-static --enable-cloog-backend=isl --with-pkgversion='x86_64-win32-sjlj,
Built by MinGW-W64 project'
--with-bugurl=http://sourceforge.net/projects/mingw-w64
 CFLAGS='-O2 -pipe
-I/d/mingwtrunk/x86_64-trunk-win32-sjlj-rt_v4/mingw64/opt/include
-I/d/mingwtrunk/prerequisites/x86_64-zlib-static/include -I/d/mingwtrunk/pr
erequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe
-I/d/mingwtrunk/x86_64-trunk-win32-sjlj-rt_v4/mingw64/opt/include
-I/d/mingwtrunk/prerequisit
es/x86_64-zlib-static/include
-I/d/mingwtrunk/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS=
LDFLAGS='-pipe -L/d/mingwtrunk/x86_64-trunk-win32-sjlj-
rt_v4/mingw64/opt/lib -L/d/mingwtrunk/prerequisites/x86_64-zlib-static/lib
-L/d/mingwtrunk/prerequisites/x86_64-w64-mingw32-static/lib'
Thread model: win32
gcc version 4.9.0 20140218 (experimental) (x86_64-win32-sjlj, Built by
MinGW-W64 project)
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fno-strict-aliasing' '-fwrapv' '-Wall'
'-Wextra' '-std=c++11' '-Ofast' '-o' 'ostream2a.exe' '-shared-libgcc'
'-mtune=co
re2' '-march=nocona'

f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.0/cc1plus.exe
-E -quiet -v -iprefix f:\x86_64-4.
9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.9.0/
-U_REENTRANT ostream2a.cpp -mtune=core2 -march=nocona -std=c++
11 -Wall -Wextra -fno-strict-aliasing -fwrapv -Ofast -fpch-preprocess -o
ostream2a.ii
ignoring duplicate directory
"f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.9.0/include"
ignoring nonexistent directory
"D:/mingwtrunk/x86_64-trunk-win32-sjlj-rt_v4/mingw64D:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../include"
ignoring duplicate directory
"f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.9.0/include-fixed"

ignoring duplicate directory
"f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/lib/gcc/../../lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../x8
6_64-w64-mingw32/include"
ignoring nonexistent directory
"D:/mingwtrunk/x86_64-trunk-win32-sjlj-rt_v4/mingw64/mingw/include"
#include "..." search starts here:
#include <...> search starts here:

f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.9.0/include

f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.9.0/include-fixed

f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../x86_64-w64-mingw32/include

f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++

f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/x86_64-w64-mingw32

f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/lib/gcc/../../x86_64-w64-mingw32/include/c++/backward
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fno-strict-aliasing' '-fwrapv' '-Wall'
'-Wextra' '-std=c++11' '-Ofast' '-o' 'ostream2a.exe' '-shared-libgcc'
'-mtune=co
re2' '-march=nocona'

f:/x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.9.0/cc1plus.exe
-fpreprocessed ostream2a.ii -quiet
 -dumpbase ostream2a.cpp -mtune=core2 -march=nocona -auxbase ostream2a -Ofast
-Wall -Wextra -std=c++11 -version -fno-strict-aliasing -fwrapv -o ostream2a.s
GNU C++ (x86_64-win32-sjlj, Built by MinGW-W64 project) version 4.9.0 20140218
(experimental) (x86_64-w64-mingw32)
        compiled by GNU C version 4.9.0 20140218 (experimental), GMP version
5.1.3, MPFR version 3.1.2-p5, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (x86_64-win32-sjlj, Built by MinGW-W64 project) version 4.9.0 20140218
(experimental) (x86_64-w64-mingw32)
        compiled by GNU C version 4.9.0 20140218 (experimental), GMP version
5.1.3, MPFR version 3.1.2-p5, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 3d656286c2fbf9376b6c665d39c3c502
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:15: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:16:12: error: within this context
 u32ostream u32cout;
            ^


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (2 preceding siblings ...)
  2014-03-30 16:47 ` jmichae3 at yahoo dot com
@ 2014-03-30 17:29 ` glisse at gcc dot gnu.org
  2014-03-30 19:30 ` jmichae3 at yahoo dot com
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-03-30 17:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
  uostream ucout;

Where did you see in the standard that basic_ostream is default constructible?
The only constructor I can find is the explicit one from basic_streambuf*.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (3 preceding siblings ...)
  2014-03-30 17:29 ` glisse at gcc dot gnu.org
@ 2014-03-30 19:30 ` jmichae3 at yahoo dot com
  2014-03-30 20:08 ` redi at gcc dot gnu.org
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-03-30 19:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jim Michaels <jmichae3 at yahoo dot com> ---
not allowed to use a basic_streambuf there either, also says it's protected.
apparently ostream() is protected. I looked, and there is a place that looks
like you can use a treambuf, but I am unable to get it to work.
ostream line 384 where it says
    protected:
      basic_ostream()
      { this->init(0); }

      template<typename _ValueT>
    __ostream_type&
    _M_insert(_ValueT __v);
    };
is where it complains.

tried typedef std::basic_ostream<std::basic_streambuf<char16_t,
std::char_traits<char16_t> > > uostream;
and got
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 = std::basic_streambuf<char32_t,
std::char_traits<char32_t> >; _Traits =
std::char_traits<std::basic_streambuf<char32_t, std::char_
traits<char32_t> > >]' is protected
       basic_ostream()
       ^
ostream2a.cpp:21:12: error: within this context
 u32ostream u32cout;
            ^

and a whole bunch of other errors. I had thought you could simply use the 
template <class charT, class traits = char_traits<charT> >
  class basic_ostream;
based definition to create a new a type to instantiate a u16cout or ucout, but
apparently this is not so because of the protected-ness of the method.
there is probably a reason for this, I know of no workaround yet.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (4 preceding siblings ...)
  2014-03-30 19:30 ` jmichae3 at yahoo dot com
@ 2014-03-30 20:08 ` redi at gcc dot gnu.org
  2014-03-30 20:24 ` jmichae3 at yahoo dot com
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-30 20:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is not a bug in GCC, your code is simply incorrect. std::basic_ostream is
only usable as a base class, not the way you're trying to use it.

Please find somewhere more suitable to solve your problem, such as
http://stackoverflow.com


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (5 preceding siblings ...)
  2014-03-30 20:08 ` redi at gcc dot gnu.org
@ 2014-03-30 20:24 ` jmichae3 at yahoo dot com
  2014-03-30 20:25 ` jmichae3 at yahoo dot com
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-03-30 20:24 UTC (permalink / raw)
  To: gcc-bugs

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

Jim Michaels <jmichae3 at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |FIXED

--- Comment #7 from Jim Michaels <jmichae3 at yahoo dot com> ---
found what I thought was a workaround, the streambuf thing is a constructor in
the basic_ostream class.
#include <ostream>
#include <streambuf>
#include <sstream>
#include <vector>
#include <string>
#include <ios>
#include <initializer_list>
#include <uchar.h>
#include <wchar.h>
typedef std::vector<std::u16string> Vu16S;
typedef std::basic_ostringstream<char16_t, std::char_traits<char16_t>,
std::allocator<char16_t> > u16ostringstream;
typedef std::basic_ostringstream<char32_t, std::char_traits<char32_t>,
std::allocator<char32_t> > u32ostringstream;
//typedef std::basic_ostream<char16_t, std::char_traits<char16_t> > u16ostream;
//typedef std::basic_ostream<char32_t, std::char_traits<char32_t> > u32ostream;
std::basic_ostringstream<std::basic_stringbuf<char16_t> > u16ograph;
std::basic_ostringstream<std::basic_stringbuf<char32_t> > u32ograph;
typedef std::basic_streambuf<char16_t, std::char_traits<char16_t> >
u16streambuf;
typedef std::basic_streambuf<char32_t, std::char_traits<char32_t> >
u32streambuf;
u16streambuf u16sb;
u32streambuf u32sb;
std::basic_ostream<char16_t, std::char_traits<char16_t> > u16cout(u16sb);
std::basic_ostream<char32_t, std::char_traits<char32_t> > u32cout(u32sb);
//uostream ucout;
//u32ostream u32cout;

Vu16S vu16blockss={u"\u00a0",u"\u2591",u"\u2592",u"\u2593",u"\u2588"};
int main(void) {
    uostringstream o16graph;
    ograph<<vu16blockss[1];
    ucout<<ograph.str();
    ucout<<u"\u00a0\u2591\u2592\u2593\u2588";
    return 0;
}

but this time streambuf is protected. :-(

f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\x86_64-w64-mingw32\include\c++\streambuf:463:7:
error: 'std::basic_streambuf<_CharT, _Trait
s>::basic_streambuf() [with _CharT = char16_t; _Traits =
std::char_traits<char16_t>]' is protected
       basic_streambuf()
       ^
ostream2a.cpp:20:14: error: within this context


hmm. I could not find a definition/constructor for basic_streambuf.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (6 preceding siblings ...)
  2014-03-30 20:24 ` jmichae3 at yahoo dot com
@ 2014-03-30 20:25 ` jmichae3 at yahoo dot com
  2014-03-30 21:20 ` jmichae3 at yahoo dot com
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-03-30 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jim Michaels <jmichae3 at yahoo dot com> ---
by the way, folks on stackoverflow.com have long struggled with this and found
no solution.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (7 preceding siblings ...)
  2014-03-30 20:25 ` jmichae3 at yahoo dot com
@ 2014-03-30 21:20 ` jmichae3 at yahoo dot com
  2014-03-30 22:32 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-03-30 21:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jim Michaels <jmichae3 at yahoo dot com> ---
it appears from 
    protected:
      /**
       *  @brief  Base constructor.
       *
       *  Only called from derived constructors, and sets up all the
       *  buffer data to zero, including the pointers described in the
       *  basic_streambuf class description.  Note that, as a result,
       *  - the class starts with no read nor write positions available,
       *  - this is not an error
      */
      basic_streambuf()
      : _M_in_beg(0), _M_in_cur(0), _M_in_end(0),
      _M_out_beg(0), _M_out_cur(0), _M_out_end(0),
      _M_buf_locale(locale())
      { }

that the streambuf class must be derived from to be used. it doesn't have the
kind of constructor I had hoped. I see no examples anywhere on how to use
streambuf. and I have not done c++ at this level, so I am thinking about giving
up, at least for now. and stackoverflow.com is copyrighted.

why is it SO DIFFICULT to do this?
everyone wants to do unicode streams. I can't do graphic block shade characters
without this (what's shown in the code) for graphs and TUIs.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (8 preceding siblings ...)
  2014-03-30 21:20 ` jmichae3 at yahoo dot com
@ 2014-03-30 22:32 ` redi at gcc dot gnu.org
  2014-04-01  1:35 ` jmichae3 at yahoo dot com
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-30 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |INVALID


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (9 preceding siblings ...)
  2014-03-30 22:32 ` redi at gcc dot gnu.org
@ 2014-04-01  1:35 ` jmichae3 at yahoo dot com
  2014-04-01  5:34 ` jmichae3 at yahoo dot com
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-04-01  1:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jim Michaels <jmichae3 at yahoo dot com> ---
learned about std::streambuf.
when I went to use it (apparently a requirement in some cases and the only
thing that works for std::ostream now), the whole streambuf heirarchy is
protected except for std::filebuf, which is useless for just a plain old
ostream.

so, it seems, std::ostream is protected so I can't use it. stdstringbuf is
protected, making it useless.

at least put some examples in the standard c++ library documentation so mortals
know how to use this seemingly impossible new class heirarchy so I can do what
would seem to be simple things.

in the template defs, I see 
extern ostream cout;

but if I try do
std::ostream o; 
I get protected errors. this used to work. tried it with streambuf, streambuf
and stringbuf is protected now so I can't use them.

is 4.9.0 just buggy because it's hasn't been released yet?

I think the "this is not a bug" messages are bogus. streams are throrouhly
broken in x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4 due to
overmuch protection.

f:\x86_64-4.9.0-snapshot-20140219-rev207854-win32-sjlj-rt_v4\mingw64\x86_64-w64-mingw32\include\c++\streambuf:463:7:
error: 'std::basic_streambuf<_CharT, _Traits>::basic_streambuf() [with _CharT =
char; _Traits = std::char_traits<char>]' is protected
grep.cpp:21:16: error: within this context

I am just saying something smells like a compiler bug here.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (10 preceding siblings ...)
  2014-04-01  1:35 ` jmichae3 at yahoo dot com
@ 2014-04-01  5:34 ` jmichae3 at yahoo dot com
  2014-04-01  5:47 ` glisse at gcc dot gnu.org
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-04-01  5:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jim Michaels <jmichae3 at yahoo dot com> changed:

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

--- Comment #11 from Jim Michaels <jmichae3 at yahoo dot com> ---
those "protected" errors also prevent std::regex from working.

std::ostream o;
causes a protected error. something is really wrong here with libstdc++'s
iostreams.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (11 preceding siblings ...)
  2014-04-01  5:34 ` jmichae3 at yahoo dot com
@ 2014-04-01  5:47 ` glisse at gcc dot gnu.org
  2014-04-01  6:08 ` jmichae3 at yahoo dot com
  2014-04-01  9:06 ` redi at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: glisse at gcc dot gnu.org @ 2014-04-01  5:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Marc Glisse <glisse at gcc dot gnu.org> ---
Before saying that there is a problem with libstdc++, did you try other
implementations? clang++ with libc++ gives the same error. That's just not how
streams are supposed to be used (pretend it is a pure virtual base class if
that helps), please invest in a book.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (12 preceding siblings ...)
  2014-04-01  5:47 ` glisse at gcc dot gnu.org
@ 2014-04-01  6:08 ` jmichae3 at yahoo dot com
  2014-04-01  9:06 ` redi at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: jmichae3 at yahoo dot com @ 2014-04-01  6:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jim Michaels <jmichae3 at yahoo dot com> changed:

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

--- Comment #13 from Jim Michaels <jmichae3 at yahoo dot com> ---
there is an ugly solution that involves using a constructor and possibly
multiple inheritance. and several lines of statements.


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [Bug libstdc++/60711] basic_ostringstream,basic_ostream,u16string,char16_t do not work together
  2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
                   ` (13 preceding siblings ...)
  2014-04-01  6:08 ` jmichae3 at yahoo dot com
@ 2014-04-01  9:06 ` redi at gcc dot gnu.org
  14 siblings, 0 replies; 16+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-01  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |INVALID

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jim Michaels from comment #10)
> I am just saying something smells like a compiler bug here.

"I don't understand C++" is not a compiler bug.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2014-04-01  9:06 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-30 16:15 [Bug libstdc++/60711] New: basic_ostringstream,basic_ostream,u16string,char16_t do not work together jmichae3 at yahoo dot com
2014-03-30 16:26 ` [Bug libstdc++/60711] " jmichae3 at yahoo dot com
2014-03-30 16:41 ` jmichae3 at yahoo dot com
2014-03-30 16:47 ` jmichae3 at yahoo dot com
2014-03-30 17:29 ` glisse at gcc dot gnu.org
2014-03-30 19:30 ` jmichae3 at yahoo dot com
2014-03-30 20:08 ` redi at gcc dot gnu.org
2014-03-30 20:24 ` jmichae3 at yahoo dot com
2014-03-30 20:25 ` jmichae3 at yahoo dot com
2014-03-30 21:20 ` jmichae3 at yahoo dot com
2014-03-30 22:32 ` redi at gcc dot gnu.org
2014-04-01  1:35 ` jmichae3 at yahoo dot com
2014-04-01  5:34 ` jmichae3 at yahoo dot com
2014-04-01  5:47 ` glisse at gcc dot gnu.org
2014-04-01  6:08 ` jmichae3 at yahoo dot com
2014-04-01  9:06 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).