Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 119a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-12-20


2630. Syntactic specification of class completeness

Section:11.4.1  [class.mem.general]    Status:C++23    Submitter:Jim X    Date:2022-07-04

[Accepted as a DR at the November, 2022 meeting.]

Consider:

// translation unit 1export module A;export class X {};// translation unit 2import A;X x; // isX complete at this point?

Subclause 11.4.1 [class.mem.general] paragraph 8 specifies:

A class is considered a completely-defined object type(6.9.1 [basic.types.general]) (or complete type) at theclosing} of theclass-specifier. ...

The syntactic (even lexical) reference to the closing}does not address the question when a different translation unitregards a class as complete. However, it seems this provision isentirely redundant given 6.3 [basic.def.odr] paragraph 13:

A definition of a class shall be reachable in every context in whichthe class is used in a way that requires the class type to becomplete.

The standard never asks the question: "Is class X complete?"; italways specifies "X shall be complete" (otherwise the program isill-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.9.1 [basic.types.general]) (or complete type) at theclosing} of theclass-specifier.TheA class is regarded as complete within itscomplete-class contexts; otherwise it is regarded as incomplete withinits own classmember-specification.

CWG telecon 2022-10-21:

Explicitly refer to reachable definitions.

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.9.1 [basic.types.general]) (or complete type) at theclosing} of theclass-specifier.TheA class is regarded as completewhere itsdefinition is reachable and within its complete-class contexts;otherwise it is regarded as incomplete within its ownclassmember-specification.



[8]ページ先頭

©2009-2026 Movatter.jp