Title
Program-definedness of closure types
Status
c++20
Section
[defns.prog.def.spec]
Submitter
Hubert Tong

Created on 2018-06-09.00:00:00 last changed 38 months ago

Messages

Date: 2018-11-12.05:21:03

Proposed resolution:

This wording is relative to N4762.

  • Modify [defns.prog.def.type] as follows:

    program-defined type
    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
Date: 2018-11-12.05:21:03

[ 2018-11 San Diego Thursday night issue processing ]

Status to Ready.

Date: 2018-08-23.00:00:00

[ 2018-08-23 Batavia Issues processing ]

Updated wording

Date: 2018-08-14.00:00:00

[ 2018-08-14 Casey provides additional discussion and a Proposed Resolution ]

We use the term "program-defined" in the library specification to ensure that two users cannot create conflicts in a component in namespace std by specifying different behaviors for the same type. For example, we allow users to specialize common_type when at least one of the parameters is a program-defined type. Since two users cannot define the same program-defined type, this rule prevents two users (or libraries) defining the same specialization of std::common_type.

Since it's guaranteed that even distinct utterances of identical lambda expressions produce closures with distinct types ([expr.prim.lambda.closure]), adding closure types to our term "program-defined type" is consistent with the intended use despite that such types are technically defined by the implementation.

Previous resolution [SUPERSEDED]:

This wording is relative to N4762.

  • Modify [defns.prog.def.type] as follows:

    program-defined type
    class type or enumeration type that is not part of the C++ standard library and not defined by the implementation (except for closure types ([expr.prim.lambda.closure]) for program-defined lambda expressions), or an instantiation of a program-defined specialization
Date: 2018-06-23.00:00:00

[ 2018-06-23 after reflector discussion ]

Priority set to 2

Date: 2018-06-18.14:22:57

The description of closure types in [expr.prim.lambda.closure] says:

An implementation may define the closure type differently […]

The proposed resolution to LWG 2139 defines a "program-defined type" to be a

class type or enumeration type that is not part of the C++ standard library and not defined by the implementation, or an instantiation of a program-defined specialization

I am not sure that the intent of whether closure types are or are not program-defined types is clearly conveyed by the wording.

History
Date User Action Args
2021-02-25 10:48:01adminsetstatus: wp -> c++20
2019-02-26 17:40:23adminsetstatus: voting -> wp
2019-01-21 04:50:04adminsetstatus: ready -> voting
2018-11-12 05:21:03adminsetmessages: + msg10220
2018-11-12 05:21:03adminsetstatus: new -> ready
2018-08-27 14:22:44adminsetmessages: + msg10135
2018-08-14 19:51:17adminsetmessages: + msg10069
2018-08-14 19:51:17adminsetmessages: + msg10068
2018-06-25 00:47:25adminsetmessages: + msg9985
2018-06-09 00:00:00admincreate