Title
Fix definition of program-defined based on its uses
Status
new
Section
[defns.prog.def.type]
Submitter
Johel Ernesto Guerrero Peña

Created on 2020-12-29.00:00:00 last changed 39 months ago

Messages

Date: 2021-01-29.17:55:43

Proposed resolution:

This wording is relative to N4878.

  1. Modify [defns.prog.def.type] as indicated:

    3.43 [defns.prog.def.type]
    program-defined type
    <library> non-closure class type or enumeration type that is not part of the C++ standard library and not defined by the implementation, or a closure type of a non-implementation-provided lambda expression, or an instantiationa name of a program-defined specialization or instantiation thereof [Note 1 to entry: Types defined by the implementation include extensions ([intro.compliance]) and internal types used by the library. — end note]
Date: 2021-01-15.00:00:00
Set priority to 3 following reflector discussions. It was pointed out that it might be easier to resolve

[ 2021-01-29; reflector prioritization ]

Set priority to 3 following reflector discussions. It was pointed out that it might be easier to resolve 3512 if this issue changes the definition of program-defined type.
Date: 2020-12-29.00:00:00

Consider the following definitions:

3.42 [defns.prog.def.spec]
program-defined specialization
<library> explicit template specialization or partial specialization that is not part of the C++ standard library and not defined by the implementation

and

3.43 [defns.prog.def.type]
program-defined type
<library> non-closure class type or enumeration type that is not part of the C++ standard library and not defined by the implementation, or a closure type of a non-implementation-provided lambda expression, or an instantiation of a program-defined specialization [Note 1 to entry: Types defined by the implementation include extensions (4.1) and internal types used by the library. — end note]

A program-defined type is either a type or an instantiation. "program-defined type" is used in [namespace.std] p2 to give permission to specialize standard class templates:

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.

ISO requires that the terms in Clause 3 be substitutable with their definitions. If this were done for "program-defined type", we'd end up with "or an instantiation of a program-defined specialization". It's fine to depend on a type, but not an instantiated type, because all you need is the name of its specialization (its type) as a template argument to explicitly or partially specialize a template.

History
Date User Action Args
2021-01-29 17:55:43adminsetmessages: + msg11666
2021-01-16 17:04:53adminsetmessages: + msg11658
2020-12-29 00:00:00admincreate