#625777 g++-mingw-w64: locale::facet::_S_create_c_locale name not valid

#625777#5
Date:
2011-03-10 15:29:15 UTC
From:
To:
Hi,

The attached c++ code always trigger an exception. However
std::locale("") should be valid on my system.

$ /usr/sbin/validlocale ""
locale '' valid and available

Compilation:

$ /usr/bin/i586-mingw32msvc-g++ l.cxx
$ wine ./a.exe
locale::facet::_S_create_c_locale name not valid

Thanks

#625777#16
Date:
2012-01-19 07:13:13 UTC
From:
To:
Hi Mathieu,

the exception is caused by the libstdc++ used to compile your
executable. This seems to be intentional, because the libstdc++ does
not support the std::locale (other than "C").

Here are some hints about the topic:

http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html
http://sources.redhat.com/bugzilla/show_bug.cgi?id=165

I am sure that this behavior is present in Lenny
(libstdc++6-4.3-dev:4.3.2-1.1) and is gone in Ubuntu 11.11
(libstdc++6-4.6-dev:)4.6.1-9ubuntu3). So somewhere in between it has
been fixed.

Bye
Christian

#625777#21
Date:
2012-01-19 22:31:09 UTC
From:
To:
Hi Christian,

Thanks for pointing that out!

I just checked with version 4.6.2, and the check against the "C"
locale and the exception for any request other than that is still
present (see libstdc++-v3/config/locale/generic/c_locale.cc in the gcc
source). Have you been able to produce Windows-targeted binaries
without this behaviour?

Regards,

Stephen

#625777#24
Date:
2012-01-19 22:31:09 UTC
From:
To:
Hi Christian,

Thanks for pointing that out!

I just checked with version 4.6.2, and the check against the "C"
locale and the exception for any request other than that is still
present (see libstdc++-v3/config/locale/generic/c_locale.cc in the gcc
source). Have you been able to produce Windows-targeted binaries
without this behaviour?

Regards,

Stephen

#625777#37
Date:
2015-05-29 11:22:50 UTC
From:
To:
If I compile `l.cxx` using VS 2010 (Win7/64bits), here is what I get:
French_France.1252

From wine32 (current jessie):

$ wine32 ./l.exe
fixme:heap:HeapSetInformation (nil) 1 (nil) 0
English_United States.1252

Now if I use i686-w64-mingw32-g++:

$ i686-w64-mingw32-g++ l.cxx -static-libgcc -static-libstdc++
$ WINEPATH=/usr/lib/gcc/i686-w64-mingw32/4.9-win32 wine32 ./a.exe
locale::facet::_S_create_c_locale name not valid

Then from my cmd prompt (Win7/64bits):
C

So clearly the behavior is slightly different (C != French locale),
but at least "" is valid.

2cts