https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58628
--- Comment #4 from Alexander Pyhalov <alp at rsu dot ru> --- If it helps, the last comment from illumos-gate bug report says "From what I can tell ctype<wchar_t>::_M_initialize_ctype() in gcc-5.1.0/ibstdc++-v3/config/locale/generic/ctype_members.cc:248 is basically just calling btowc(i) for all i <= 0 <= 255 and storing the result. If std::locale::classic() is called before the setlocale() call in the test program, things happen to work, but apparently the initialization uses whatever the current locale is."