http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52540
--- Comment #11 from Pawel Sikora <pluto at agmk dot net> 2012-03-11 19:49:41 UTC --- (In reply to comment #9) > Then this is a very old issue, isn't it? Why nobody noticed it before? To be > clear, in debug-mode we don't use extern templates only for basic_string > (because _GLIBCXX_EXTERN_TEMPLATE becomes -1 when _GLIBCXX_DEBUG is defined), > all the other facilities remain the same still use extern tamplate. This is in > order to enable debug-mode checks also at -O0 for basic_string. Now, I don't > see why a few less extern template can make a difference on mingw in terms of > correctness of use_facet or anything else, but if that's really the case due > to > fundamental limitations somehwhere, we can trade it for the -O0 basic_string > checks on the affected systems, I have no problems with that (note that, > AFAICS, the problem will not go away with a new C++11 conforming string class, > unless we decide to not export from the .so parts of basic_string) i'm not sure the problem is in std::string details. in the debug-mode the use_facet is no more extern template and instantiates in client code, especially the static facet's field like std::locale::id. is this 'id' and other static details correctly initialized in (non-extern-template) debug-mode?