Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Aug 2014 12:31:45 +0400
From:      Alexander Pyhalov <alp@rsu.ru>
To:        freebsd-current@freebsd.org
Subject:   gcc / clang std::locale issue on non-glibc platforms
Message-ID:  <53EDC571.6020003@rsu.ru>

next in thread | raw e-mail | index | archive | help
Hello.
I just stumped on the following gcc bug - 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=15992 (std::locale is not 
working for non-C locales).

It seems to affect all non-glibc platforms (reproducible on FreeBSD and 
illumos). Tried the same test with clang - no difference (as affected 
code is in libstdc++). Simple test case:

$ cat t.cpp
#include <locale>

int main (int argc, char *argv[])
{
     for (int i = 1; i < argc; ++i) {
         try {
             const std::locale loc (argv [i]);
         }
         catch (std::exception &e) {
             printf ("exception: %s: %s\n", argv [i], e.what ());
         }
     }
}

$ g++ -o locale t.cpp   # or clang++ -o locale t.cpp , doesn't matter
  ./locale en_US.UTF-8
exception: en_US.UTF-8: locale::facet::_S_create_c_locale name not valid

-- 
Best regards,
Alexander Pyhalov,
system administrator of Computer Center of Southern Federal University



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53EDC571.6020003>