This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++23 status.
Section: 16.4.5.2.1 [namespace.std] Status: C++23 Submitter: Johel Ernesto Guerrero Peña Opened: 2018-12-11 Last modified: 2023-11-22
Priority: 3
View other active issues in [namespace.std].
View all other issues in [namespace.std].
View all issues with C++23 status.
Discussion:
The permission denoted by [namespace.std]/3 should be limited to program-defined types.
[2018-12-21 Reflector prioritization]
Set Priority to 3
Previous resolution [SUPERSEDED]:
This wording is relative to N4791.
Change 16.4.5.2.1 [namespace.std] as indicated:
-2- Unless explicitly prohibited, a program may add a template specialization for any standard library class template to namespace
-3- The behavior of a C++ program is undefined if it declares an explicit or partial specialization of any standard library variable template, except where explicitly permitted by the specification of that variable template, provided that the added declaration depends on at least one program-defined type.std
provided that (a) the added declaration depends on at least one program-defined type and (b) the specialization meets the standard library requirements for the original template.(footnote 174)
[2022-08-24; LWG telecon]
Each variable template that grants permission to specialize already
states requirements more precisely than proposed here anyway.
For example, disable_sized_range
only allows it for
cv-unqualified program-defined types.
Adding less precise wording here wouldn't be an improvement.
Add a note to make it clear we didn't just forget to say something here,
and to remind us to state requirements for each variable template in future.
[2022-08-25; Jonathan Wakely provides improved wording]
[2022-09-28; Reflector poll]
Set status to Tentatively Ready after seven votes in favour during reflector poll.
[2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP.]
Proposed resolution:
This wording is relative to N4910.
Change 16.4.5.2.1 [namespace.std] as indicated:
-2- Unless explicitly prohibited, a program may add a template specialization for any standard library class template to namespace
std
provided that (a) the added declaration depends on at least one program-defined type and (b) the specialization meets the standard library requirements for the original template.(footnote 163)-3- The behavior of a C++ program is undefined if it declares an explicit or partial specialization of any standard library variable template, except where explicitly permitted by the specification of that variable template.
[Note 1: The requirements on an explicit or partial specialization are stated by each variable template that grants such permission. — end note]