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


594. Coordinating issues 119 and 404 with delegating constructors

Section:6.8.4  [basic.life]    Status:CD1    Submitter:Tom Plum    Date:30 August 2006

[Voted into the WP at the September, 2008 meeting.]

In ISO/IEC 14882:2003, the second bullet of 6.8.4 [basic.life] paragraph 1 reads,

ifT is a class type with a non-trivial constructor(11.4.5 [class.ctor]), the constructor call has completed.

Issue 119 pointed out thataggregate initialization can be used with some classes with anon-trivial implicitly-declared default constructor, and thatin such cases there is no call to the object's constructor.The resolution for that issue was to change the previously-citedwording to read,

IfT is a class type with a non-trivial constructor(11.4.5 [class.ctor],the initialization is complete.

Later (but before the WP was revised with the wording fromthe resolution ofissue 119),issue 404 changed the 2003 wording toread,

IfT is a class typeand the constructor invoked tocreate the object is non-trivial (11.4.5 [class.ctor]),the constructor call has completed.

thus reversing the effect ofissue 119,whose whole purpose was to cover objects with non-trivial constructorsthat arenot invoked.

Through an editorial error, the post-Redmond draft (N1905)still contained the original 2003 wording that should have beenreplaced by the resolution ofissue 119,in addition to the new wording from theresolution:

ifT is a class type and the constructor invoked tocreate the object is non-trivial (11.4.5 [class.ctor]),the constructor call has completed. the initialization iscomplete.

Finally, during the application of the edits for delegatingconstructors (N1986), this editing error was “fixed”by retaining the original 2003 wording (which was needed for theapplication of the change specified in N1986), so that thecurrent draft (N2009) reads,

ifT is a class type and the constructor invoked tocreate the object is non-trivial (11.4.5 [class.ctor]),the principal constructor call 11.9.3 [class.base.init]) hascompleted.

Because the completion of the call to the principal constructorcorresponds to the point at which the object is “fullyconstructed” (14.3 [except.ctor] paragraph 2), i.e.,its initialization is complete, I believe that the exact wordingof theissue 119 resolution would becorrect and should be restored verbatim.

Proposed resolution (June, 2008):

Change 6.8.4 [basic.life] paragraph 1 as follows:

Thelifetime of an object is a runtime property of theobject.An object is said to have non-trivial initialization if itis of a class or aggregate type and it or one of its members isinitialized by a constructor other than a trivial defaultconstructor. [Note: Initialization by a trivial copyconstructor is non-trivial initialization. —end note]The lifetime of an objectof typeT begins when:

The lifetime of an object of typeT ends when...




[8]ページ先頭

©2009-2026 Movatter.jp