Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-06-14 11:58:34


Hi Chris,

> Documentation states that shmem should compile on this platform but,
> I've discovered an interesting error with char_traits. In all shmem
> streams, I have problems with the type referencing of post_type - I'm
> getting this error:
>
> error: no type named `pos_type' in `struct std::char_traits<wchar_t>'
>
> Below is the gcc output of my build error. Any help with this is
> greatly appreciated!

This error is familiar. I had it when doing the tests and I found that
char_traits was defined for gcc:

#if defined (_GLIBCXX_USE_WCHAR_T) || defined (_GLIBCXX_USE_WSTRING)
   /// 21.1.3.2 char_traits specializations
   template<>
     struct char_traits<wchar_t>
     {
       typedef wchar_t char_type;
       typedef wint_t int_type;
       typedef streamoff off_type;
#if defined (_GLIBCXX_USE_WCHAR_T)
       typedef wstreampos pos_type;
       typedef mbstate_t state_type;
#endif

avoids defining pos_type if _GLIBCXX_USE_WCHAR_T is not defined. It
seems that mingw defines _GLIBCXX_USE_WSTRING but not
_GLIBCXX_USE_WSTRING. Consequence: you can't use wide streams.

I modified my local header to pass the tests... and that's why my local
tests succeed. The error is produced by the explicit instantiations of
bufferstream_test.cpp:

//Force instantiations to catch compile-time errors
template class basic_bufferbuf<char>;
template class basic_bufferbuf<wchar_t>;
template class basic_bufferstream<char>;
template class basic_bufferstream<wchar_t>;
template class basic_ibufferstream<char>;
template class basic_ibufferstream<wchar_t>;
template class basic_obufferstream<char>;
template class basic_obufferstream<wchar_t>;

Comment instantiations taking wchar_t parameter to avoid the error.

Googling around, I've found that Boost.Iostreams
documentation(http://www.boost.org/libs/iostreams/doc/portability.html)
marks gcc-mingw 3.2-4.0 as "Wide streams are not supported". So I'm
afraid you've found a bug in the Shmem test. Wide stream instantiations
should be removed or surrounded by an #ifdef when mingw is being used.

Thanks and regards,

Ion


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net