[Bug libstdc++/38365] New: Locale, constructed from named and unnamed locales, become named

tsyvarev at ispras dot ru gcc-bugzilla@gcc.gnu.org
Tue Dec 2 09:02:00 GMT 2008


Locale constructor

locale(const locale& other, const locale& one, locale::category cats)

creates named locale when 'other' - named locale, but 'one' - unnamed.

According to 22.1.1 p8:
A locale constructed from a name string (such as "POSIX"), or from parts of two
named locales, has a name; all others do not.

Example:
[test.cpp]
#include <locale>
#include <iostream>
using namespace std;

int main()
{
    locale other(locale("C"));
    locale one(locale("en_US"), new ctype<char>());
    locale loc(other, one, locale::collate);
    cout << "one.name() is " << one.name() << endl;
    cout << "other.name() is " << other.name() << endl;
    cout << "loc.name() is " << loc.name() << endl;
    return 0;
}

[tester@Fedore8 locale_name]$ g++ test.cpp && ./a.out
one.name() is *
other.name() is C
loc.name() is C
[tester@Fedore8 locale_name]$ g++ --version
g++ (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8)
Copyright (C) 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


-- 
           Summary: Locale, constructed from named and unnamed locales,
                    become named
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tsyvarev at ispras dot ru


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



More information about the Gcc-bugs mailing list