436. are cv-qualified facet types valid facets?

Section: 25.3.1.1.2 [locale.facet] Status: CD1 Submitter: Martin Sebor Opened: 2003-10-15 Last modified: 2016-02-10

Priority: Not Prioritized

View all other issues in [locale.facet].

View all issues with CD1 status.

Discussion:

Is "const std::ctype<char>" a valid template argument to has_facet, use_facet, and the locale template ctor? And if so, does it designate the same Facet as the non-const "std::ctype<char>?" What about "volatile std::ctype<char>?" Different implementations behave differently: some fail to compile, others accept such types but behave inconsistently.

Proposed resolution:

Change 22.1.1.1.2, p1 to read:

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 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.

[Kona: changed the last sentence from a footnote to normative text.]