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.

2694. Application of LWG 436 accidentally deleted definition of "facet"

Section: 30.3.1.2.2 [locale.facet] Status: C++17 Submitter: Tim Song Opened: 2016-04-15 Last modified: 2017-07-30

Priority: 3

View all other issues in [locale.facet].

View all issues with C++17 status.

Discussion:

[locale.facet]/1 (then-called [lib.locale.facet]) read in C++03:

Class facet is the base class for locale feature sets. A class is a facet if it is publicly derived from another facet, or if it is a class derived from locale::facet and containing a publicly-accessible declaration as follows: [Footnote: This is a complete list of requirements; there are no other requirements. Thus, a facet class need not have a public copy constructor, assignment, default constructor, destructor, etc.]

static ::std::locale::id id;

Template parameters in this clause which are required to be facets are those named Facet in declarations. A program that passes a type that is not a facet, as an (explicit or deduced) template parameter to a locale function expecting a facet, is ill-formed.

LWG 436's intent appears to be to ban volatile-qualified facets and permitting const-qualified ones. The PR was somewhat poorly worded, however, and the editor in applying it deleted the whole first half of the paragraph, including the definition of facet and the requirement for a static data member named id.

As a result, we have things like 30.3.1.2.3 [locale.id]/2 and 30.3.2 [locale.global.templates]/1 referring to the id member that's not defined anywhere in the working draft.

[2016-08-03 Chicago]

Fri AM: Moved to Tentatively Ready

Proposed resolution:

This wording is relative to N4582.

  1. Insert the following paragraph before 30.3.1.2.2 [locale.facet]/1:

    -?- Class facet is the base class for locale feature sets. A class is a facet if it is publicly derived from another facet, or if it is a class derived from locale::facet and containing a publicly accessible declaration as follows: [Footnote: This is a complete list of requirements; there are no other requirements. Thus, a facet class need not have a public copy constructor, assignment, default constructor, destructor, etc.]

    static ::std::locale::id id;
    

    -1- Template parameters in this Clause which are required to be facets are those named Facet in declarations. A program that passes a type that is not a facet, or a type that refers to a volatile-qualified facet, as an (explicit or deduced) template parameter to a locale function expecting a facet, is ill-formed. A const-qualified facet is a valid template argument to any locale function that expects a Facet template parameter.