Created on 2022-07-04.00:00:00 last changed 16 months ago
Proposed resolution (approved by CWG 2022-11-09):
Change in 11.4.1 [class.mem.general] paragraph 8 as follows:
A class is considered a completely-defined object type (6.8.1 [basic.types.general]) (or complete type) at the closing } of the class-specifier. TheA class is regarded as complete where its definition is reachable and within its complete-class contexts; otherwise it is regarded as incomplete within its own class member-specification.
CWG telecon 2022-10-21:
Explicitly refer to reachable definitions.
[Accepted as a DR at the November, 2022 meeting.]
Consider:
// translation unit 1 export module A; export class X {}; // translation unit 2 import A; X x; // is X complete at this point?
Subclause 11.4.1 [class.mem.general] paragraph 8 specifies:
A class is considered a completely-defined object type (6.8.1 [basic.types.general]) (or complete type) at the closing } of the class-specifier. ...
The syntactic (even lexical) reference to the closing } does not address the question when a different translation unit regards a class as complete. However, it seems this provision is entirely redundant given 6.3 [basic.def.odr] paragraph 13:
A definition of a class shall be reachable in every context in which the class is used in a way that requires the class type to be complete.
The standard never asks the question: "Is class X complete?"; it always specifies "X shall be complete" (otherwise the program is ill-formed).
Possible resolution [SUPERSEDED]:
Change in 11.4.1 [class.mem.general] paragraph 8 as follows:
A class is considered a completely-defined object type (6.8.1 [basic.types.general]) (or complete type) at the closing } of the class-specifier. TheA class is regarded as complete within its complete-class contexts; otherwise it is regarded as incomplete within its own class member-specification.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-07-16 13:00:43 | admin | set | status: open -> c++23 |
2023-07-16 13:00:43 | admin | set | status: drwp -> open |
2023-02-18 18:43:04 | admin | set | status: dr -> drwp |
2022-11-25 05:14:04 | admin | set | status: ready -> dr |
2022-11-10 14:54:29 | admin | set | status: review -> ready |
2022-11-10 14:54:29 | admin | set | messages: + msg7015 |
2022-11-10 14:54:29 | admin | set | status: review -> review |
2022-11-10 14:54:29 | admin | set | status: review -> review |
2022-11-10 14:54:29 | admin | set | messages: + msg6995 |
2022-11-10 14:54:29 | admin | set | status: review -> review |
2022-10-30 07:00:39 | admin | set | status: ready -> review |
2022-10-30 07:00:39 | admin | set | status: ready -> ready |
2022-10-30 07:00:39 | admin | set | status: ready -> ready |
2022-10-30 07:00:39 | admin | set | status: open -> ready |
2022-07-04 00:00:00 | admin | create |