Title
Limit permission to specialize variable templates to program-defined types
Status
c++23
Section
[namespace.std]
Submitter
Johel Ernesto Guerrero Peña

Created on 2018-12-11.00:00:00 last changed 12 months ago

Messages

Date: 2022-11-17.00:42:33

Proposed resolution:

This wording is relative to N4910.

  • Change [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]

Date: 2022-11-12.00:00:00

[ 2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP. ]

Date: 2022-09-15.00:00:00

[ 2022-09-28; Reflector poll ]

Set status to Tentatively Ready after seven votes in favour during reflector poll.

Date: 2022-08-15.00:00:00

[ 2022-08-25; Jonathan Wakely provides improved wording ]

Date: 2022-08-15.00:00:00

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

Date: 2018-12-21.00:00:00

[ 2018-12-21 Reflector prioritization ]

Set Priority to 3

Previous resolution [SUPERSEDED]:

This wording is relative to N4791.

  1. Change [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 174)

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

Date: 2018-12-11.00:00:00

The permission denoted by [namespace.std]/3 should be limited to program-defined types.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-11-17 00:42:33adminsetmessages: + msg13044
2022-11-17 00:42:33adminsetstatus: voting -> wp
2022-11-08 03:46:49adminsetstatus: ready -> voting
2022-09-29 18:22:01adminsetmessages: + msg12834
2022-09-29 18:22:01adminsetstatus: open -> ready
2022-08-25 19:38:47adminsetmessages: + msg12718
2022-08-25 19:38:47adminsetmessages: + msg12717
2022-08-25 19:38:47adminsetstatus: new -> open
2018-12-21 15:26:00adminsetmessages: + msg10266
2018-12-16 12:00:40adminsetmessages: + msg10260
2018-12-11 00:00:00admincreate