Title
Locale name when the provided Facet is a nullptr
Status
ready
Section
[locale.cons]
Submitter
Juan Soulie

Created on 2013-09-04.00:00:00 last changed 4 weeks ago

Messages

Date: 2022-11-08.23:16:41

Proposed resolution:

This wording is relative to N4917.

  1. Modify [locale.cons] as indicated:

    explicit locale(const char* std_name);
    

    -2- Effects: Constructs a locale using standard C locale names, e.g., "POSIX". The resulting locale implements semantics defined to be associated with that name.

    -3- Throws: runtime_error if the argument is not valid, or is null.

    -4- Remarks: The set of valid string argument values is "C", "", and any implementation-defined values.

    explicit locale(const string& std_name);
    

    -5- Effects: The same asEquivalent to locale(std_name.c_str()).

    locale(const locale& other, const char* std_name, category cats);
    

    -?- Preconditions: cats is a valid category value ([locale.category]).

    -6- Effects: Constructs a locale as a copy of other except for the facets identified by the category argument, which instead implement the same semantics as locale(std_name).

    -7- Throws: runtime_error if the second argument is not valid, or is null.

    -8- Remarks: The locale has a name if and only if other has a name.

    locale(const locale& other, const string& std_name, category cats);
    

    -9- Effects: The same asEquivalent to locale(other, std_name.c_str(), cats).

    template<class Facet> locale(const locale& other, Facet* f);
    

    -10- Effects: Constructs a locale incorporating all facets from the first argument except that of type Facet, and installs the second argument as the remaining facet. If f is null, the resulting object is a copy of other.

    -11- Remarks: If f is null, the resulting locale has the same name as other. Otherwise, the The resulting locale has no name.

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

    -?- Preconditions: cats is a valid category value.

    -12- Effects: Constructs a locale incorporating all facets from the first argument except for those that implement cats, which are instead incorporated from the second argument.

    -13- Remarks: If cats is equal to locale::none, the resulting locale has a name if and only if the first argument has a name. Otherwise, the The locale has a name if and only if the first two arguments both have names.

Date: 2022-11-09.01:07:36

[ Kona 2022-11-08; Move to Ready status ]

Date: 2022-11-15.00:00:00

[ 2022-11-04; Jonathan revises wording after feedback ]

Revert an incorrect edit to p8, which was incorrectly changed to:

"If cats is equal to locale::none, the resulting locale has the same name as locale(std_name). Otherwise, the locale has a name if and only if other has a name."

Date: 2022-10-15.00:00:00

[ 2022-11-01; Jonathan provides wording ]

This also resolves 3673 and 3676.

Date: 2022-02-15.00:00:00

[ 2022-02-14; Daniel comments ]

This issue seems to have some overlap with LWG 3676 so both should presumably be resolved in a harmonized way.

Date: 2013-09-04.00:00:00

[locale.cons] p14 ends with:

"[…] If f is null, the resulting object is a copy of other."

but the next line p15 says:

"Remarks: The resulting locale has no name."

But both can't be true when other has a name and f is null.

I've tried it on two implementations (MSVC,GCC) and they are inconsistent with each other on this.

Daniel Krügler:

As currently written, the Remarks element applies unconditionally for all cases and thus should "win". The question arises whether the introduction of this element by LWG 424 had actually intended to change the previous Note to a Remarks element. In either case the wording should be improved to clarify this special case.

History
Date User Action Args
2022-11-09 01:07:36adminsetstatus: immediate -> ready
2022-11-08 23:16:41adminsetmessages: + msg12969
2022-11-08 23:16:41adminsetstatus: new -> immediate
2022-11-07 17:36:29adminsetmessages: + msg12947
2022-11-01 15:05:20adminsetmessages: + msg12902
2022-11-01 15:05:20adminsetmessages: + msg12901
2022-02-14 17:23:53adminsetmessages: + msg12378
2013-09-04 00:00:00admincreate