I came across this while investigating (most likely) a related problem in
Apache stdcxx. Btw., I suspect the bg_BG locale is incorrect in defining
thousands_sep to NUL and filed
http://sources.redhat.com/bugzilla/show_bug.cgi?id=5599

$ cat t.cpp && g++ -dumpversion && g++ t.cpp && LC_NUMERIC=bg_BG locale -ck
LC_NUMERIC && ./a.out bg_BG | od -c
#include <cassert>
#include <clocale>
#include <cstdio>
#include <locale>
#include <string>

int main (int argc, char *argv[])
{
    const char* const name = 1 < argc ? argv [1] : "bg_BG";

    const std::locale bg (name);

    const std::numpunct<char> &np =
        std::use_facet<std::numpunct<char> >(bg);

    const char ts = np.thousands_sep ();
    const std::string grp = np.grouping ();

    std::setlocale (LC_ALL, name);
    const lconv* const pconv = std::localeconv ();

    std::printf ("'\\x%02x' == '\\x%02x'\n", ts, *pconv->thousands_sep);
    std::printf ("\"%s\" == \"%s\"\n", grp.c_str (), pconv->grouping);

    assert (ts == *pconv->thousands_sep);
    assert (grp == pconv->grouping);
}

4.1.2
LC_NUMERIC
decimal_point=","
thousands_sep=""
grouping=3;3
numeric-decimal-point-wc=44
numeric-thousands-sep-wc=0
numeric-codeset="CP1251"
a.out: t.cpp:26: int main(int, char**): Assertion `grp == pconv->grouping'
failed.
0000000   '   \   x   0   0   '       =   =       '   \   x   0   0   '
0000020  \n   "   "       =   =       " 003 003   "  \n
0000034


-- 
           Summary: numpunct::grouping() doesn't match libc value for
                    Bulgarian (bg_BG) locale
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34733

Reply via email to