Issue of the Implementation # S0745


Locale, constructed from named and unnamed locales, become named

Detailed Description

Common locale description says (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. Named locales may be compared for equality; an unnamed locale is equal only to (copies of) itself. For an unnamed locale, locale::name() returns the string “*”.

But constructor

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

creates locale, for which name() returns not "*", in case when
other - named locale ( returns not "*"), but
one - unnamed locale ( returns "*").

The example below demonstrated such behaviour of the function.

Problem location(s) in the standard

Linux Standard Base C++ Specification 3.2, Chapter 9. Libraries, 9.1. Interfaces for libstdcxx that refers ISO/IEC 14882: 2003 Programming languages --C++, section 22.1.1


#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 << " is " << << endl;
    cout << " is " << << endl;
    cout << " is " << << endl;
    return 0;




GCC Bugzilla 38365


Fixed in gcc-4.4.0