- Package:
- g++-mingw-w64
- Source:
- gcc-mingw-w64
- Submitter:
- Mathieu Malaterre
- Date:
- 2015-05-29 11:27:04 UTC
- Severity:
- important
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
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
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
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
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