This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

### 2394. `locale::name` specification unclear — what is implementation-defined?

Section: 28.3.1.4 [locale.members] Status: C++17 Submitter: Richard Smith Opened: 2014-06-09 Last modified: 2017-07-30

Priority: 3

View all other issues in [locale.members].

View all issues with C++17 status.

Discussion:

28.3.1.4 [locale.members] p5 says:

> Returns: The name of `*this`, if it has one; otherwise, the string `"*"`. If `*this` has a name, then `locale(name().c_str())` is equivalent to `*this`. Details of the contents of the resulting string are otherwise implementation-defined.

So… what is implementation-defined here, exactly? The first sentence completely defines the behavior of this function in all cases.

Also, the second sentence says (effectively) that all locales with the same name are equivalent: given `L1` and `L2` that have the same name `N`, they are both equivalent to `locale(N)`, and since there is no definition of "equivalent" specific to `locale`, I assume it's the normal transitive equivalence property, which would imply that `L1` is equivalent to `L2`. I'm not sure why this central fact is in the description of `locale::name`, nor why it's written in this roundabout way.

[2016-08-03 Chicago LWG]

Walter, Nevin, and Jason provide initial Proposed Resolution.

[2016-08 - Chicago]

Thurs PM: Moved to Tentatively Ready

Proposed resolution:

This wording is relative to N4606.

1. Change 28.3.1.4 [locale.members] as indicated:

   >     basic_string<char> name() const;

   > > -5- Returns: The name of `*this`, if it has one; otherwise, the string `"*"`. If `*this` has a name, then `locale(name().c_str())` is equivalent to `*this`. Details of the contents of the resulting string are otherwise implementation-defined.