Title
Program-definedness of closure types
Status
new
Section
[defns.program.defined.spec]
Submitter
Hubert Tong

Created on 2018-06-09.00:00:00, last changed 2018-08-27.14:22:44.

Messages

Date: 2018-08-27.14:22:44

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-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
2018-08-27 14:22:44adminsetmessages: + msg10098
2018-08-14 19:51:17adminsetmessages: + msg10033
2018-08-14 19:51:17adminsetmessages: + msg10032
2018-06-25 00:47:25adminsetmessages: + msg9949
2018-06-09 00:00:00admincreate