------- Comment #1 from pcarlini at suse dot de 2007-06-07 08:51 ------- (In reply to comment #0) > std::wstring wstr = L"Hello, World!";
A couple of clarifications. First, your way of using --short-wchar cannot work in principle, because std::string functions are exported from the installed .so, which is built *without* --short-wchar. At minimum, for consistency, the library itself should be rebuilt at installation time with that switch. In the specific case above, where you are using the constructor taking a "C" string, it forwards to the underlying glibc wcslen in order to compute the length of the initializer "C" string, which is computing the length incorrectly: we alredy knew that, glibc doesn't work completely fine together with --short-wchar: the docs are pretty clear that on GNU systems a wchar_t is always assumed to be 32 bits. I don't think there is a way to deal portably with such issues within C++03: the new C++0x will include char16_t and char23_t types and everything will be straightforward. In the meanwhile, as far as I know, most of the library has chances to work fine if you provide replacement std::char_traits not forwarding to underlying C functions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32240