@@ -2062,7 +2062,7 @@ <h3><a href="#guards"> 2.8 Initialization Guard Variables </a></h3>
20622062Usage of the other bytes of the guard variable is implementation-defined.
20632063
20642064< p >
2065- See < a href =#once-ctor > Section 3.3.2 </ a >
2065+ See < a href =#once-ctor > Section 3.3.3 </ a >
20662066for the API for references to this guard variable.
20672067
20682068
@@ -3160,10 +3160,11 @@ <h3><a href="#obj-ctor"> 3.3 Construction and Destruction APIs </a></h3>
31603160This includes:
31613161< ul >
31623162< li > < a href =#subobj-ctor > 3.3.1 Subobject Construction and Destruction</ a >
3163- < li > < a href =#once-ctor > 3.3.2 One-time Construction API </ a >
3164- < li > < a href =#array-ctor > 3.3.3 Array Construction and Destruction API </ a >
3165- < li > < a href =#ctor-order > 3.3.4 Controlling Object Construction Order </ a >
3166- < li > < a href =#dso-dtor > 3.3.5 DSO Object Destruction API </ a >
3163+ < li > < a href =#inh-ctor > 3.3.2 Construction by Inherited Constructor</ a >
3164+ < li > < a href =#once-ctor > 3.3.3 One-time Construction API </ a >
3165+ < li > < a href =#array-ctor > 3.3.4 Array Construction and Destruction API </ a >
3166+ < li > < a href =#ctor-order > 3.3.5 Controlling Object Construction Order </ a >
3167+ < li > < a href =#dso-dtor > 3.3.6 DSO Object Destruction API </ a >
31673168</ ul >
31683169
31693170
@@ -3271,9 +3272,59 @@ <h4><a href="#subobj-ctor"> 3.3.1 Subobject Construction and Destruction </a></h
32713272</ dl >
32723273
32733274
3275+ < p >
3276+ < a name ="inh-ctor "> </ a >
3277+ < h4 > < a href ="#inh-ctor "> 3.3.2 Construction by Inherited Constructor</ a > </ h4 >
3278+
3279+ < p >
3280+ A constructor inherited from a base class can be used to initialize a derived
3281+ class object, if it is explicitly inherited by a < code > using</ code >
3282+ declaration. Formally, such initialization is not performed by a derived class
3283+ constructor, and instead the initialization expression itself directly
3284+ initializes each base class (recursively, if the constructor is inherited from
3285+ an indirect base class) and each non-static data member. To reduce code
3286+ duplication, this ABI permits such initialization to be factored out into an
3287+ < i > inheriting constructor</ i > function.
3288+
3289+ < p >
3290+ An inheriting constructor describes the initialization that would be performed
3291+ when a constructor inherited from a base class is selected to initialize a
3292+ derived class, including the default-initialization of the other base classes
3293+ and the non-static data members of the derived class. If the inheriting
3294+ constructor is a base subobject constructor and the inherited constructor
3295+ constructs a morally virtual base subobject, the inheriting constructor does
3296+ not take any user-declared parameters; otherwise, it takes the same parameters
3297+ as the inherited constructor. In all other respects, an inheriting constructors
3298+ behaves the same as a constructor of the derived class. For example:
3299+
3300+ < code > < pre >
3301+ struct X { X(); };
3302+ struct A { A(int); };
3303+ struct B : A { using A::A; };
3304+ struct C : virtual B { using B::B; X x; };
3305+ struct D : C { using C::C; };
3306+ C c(0);
3307+ D d(0);
3308+
3309+ // The initializations of c and d behave as if they call C::C< sub > complete A(int)</ sub > (0) and D::D< sub > complete A(int)</ sub > (0):
3310+ D::D< sub > complete A(int)</ sub > (int n) : B< sub > base A(int)</ sub > (n), C< sub > base A(int)</ sub > () {} // _ZN1DCI11AEi
3311+ C::C< sub > complete A(int)</ sub > (int n) : B< sub > base A(int)</ sub > (n), x() {} < sub > </ sub > // _ZN1CCI11AEi
3312+ C::C< sub > base A(int)</ sub > () : /*no init for vbase B*/ x() {} < sub > </ sub > < sub > </ sub > // _ZN1CCI21AEi
3313+ B::B< sub > base A(int)</ sub > (int n) : A(n) {} < sub > </ sub > < sub > </ sub > // _ZN1BCI21AEi
3314+ </ pre > </ code >
3315+
3316+ < p >
3317+ Inheriting constructors are not permitted to make copies of their parameters
3318+ when passing them to the inherited constructor. If it would not be possible to
3319+ transparently forward all parameters from the inheriting constructor to the
3320+ inherited constructor, an inheriting constructor cannot be used, and a
3321+ different implementation technique (such as emitting the initialization inline)
3322+ must be used instead.
3323+
3324+
32743325< p >
32753326< a name ="once-ctor "> </ a >
3276- < h4 > < a href ="#once-ctor "> 3.3.2 One-time Construction API </ a > </ h4 >
3327+ < h4 > < a href ="#once-ctor "> 3.3.3 One-time Construction API </ a > </ h4 >
32773328
32783329< p >
32793330As described in < a href =#guards > Section 2.8</ a > , certain objects with
@@ -3403,7 +3454,7 @@ <h4><a href="#once-ctor"> 3.3.2 One-time Construction API </a></h4>
34033454
34043455< p >
34053456< a name ="array-ctor ">
3406- < h4 > < a href ="#array-ctor "> 3.3.3 Array Construction and Destruction API </ a > </ h4 >
3457+ < h4 > < a href ="#array-ctor "> 3.3.4 Array Construction and Destruction API </ a > </ h4 >
34073458
34083459< p >
34093460An ABI-compliant system shall provide several runtime routines for use
@@ -3649,11 +3700,11 @@ <h4><a href="#array-ctor"> 3.3.3 Array Construction and Destruction API </a></h4
36493700
36503701< p >
36513702< a name ="ctor-order ">
3652- < h4 > < a href ="#ctor-order "> 3.3.4 Controlling Object Construction Order </ a > </ h4 >
3703+ < h4 > < a href ="#ctor-order "> 3.3.5 Controlling Object Construction Order </ a > </ h4 >
36533704
36543705< p >
36553706< a name ="ctor-order-motivation ">
3656- < h5 > < a href ="#ctor-order-motivation "> 3.3.4 .1 Motivation </ a > </ h5 >
3707+ < h5 > < a href ="#ctor-order-motivation "> 3.3.5 .1 Motivation </ a > </ h5 >
36573708
36583709< p >
36593710< i >
@@ -3676,7 +3727,7 @@ <h5><a href="#ctor-order-motivation"> 3.3.4.1 Motivation </a></h5>
36763727
36773728< p >
36783729< a name ="ctor-order-pragma ">
3679- < h5 > < a href ="#ctor-order-pragma "> 3.3.4 .2 Source Code API </ a > </ h5 >
3730+ < h5 > < a href ="#ctor-order-pragma "> 3.3.5 .2 Source Code API </ a > </ h5 >
36803731
36813732< p >
36823733A user may specify the construction priority with the pragma:
@@ -3706,7 +3757,7 @@ <h5><a href="#ctor-order-pragma"> 3.3.4.2 Source Code API </a></h5>
37063757
37073758< p >
37083759< a name ="ctor-order-object-file ">
3709- < h5 > < a href ="#ctor-order-object-file "> 3.3.4 .3 Object File Representation </ a > </ h5 >
3760+ < h5 > < a href ="#ctor-order-object-file "> 3.3.5 .3 Object File Representation </ a > </ h5 >
37103761
37113762< p >
37123763Initialization priority is represented in the object file by elements
@@ -3744,7 +3795,7 @@ <h5><a href="#ctor-order-object-file"> 3.3.4.3 Object File Representation </a></
37443795
37453796< p >
37463797< a name ="ctor-order-runtime ">
3747- < h5 > < a href ="#ctor-order-runtime "> 3.3.4 .4 Runtime Library Support </ a > </ h5 >
3798+ < h5 > < a href ="#ctor-order-runtime "> 3.3.5 .4 Runtime Library Support </ a > </ h5 >
37483799
37493800< p >
37503801Each implementation supporting priority initialization shall provide
@@ -3760,7 +3811,7 @@ <h5><a href="#ctor-order-runtime"> 3.3.4.4 Runtime Library Support </a></h5>
37603811
37613812< p >
37623813< a name ="ctor-order-linker ">
3763- < h5 > < a href ="#ctor-order-linker "> 3.3.4 .5 Linker Processing </ a > </ h5 >
3814+ < h5 > < a href ="#ctor-order-linker "> 3.3.5 .5 Linker Processing </ a > </ h5 >
37643815
37653816< p >
37663817The only required static linker processing is to concatenate the
@@ -3804,11 +3855,11 @@ <h5><a href="#ctor-order-linker"> 3.3.4.5 Linker Processing </a></h5>
38043855
38053856< p >
38063857< a name ="dso-dtor ">
3807- < h4 > < a href ="#dso-dtor "> 3.3.5 DSO Object Destruction API </ a > </ h4 >
3858+ < h4 > < a href ="#dso-dtor "> 3.3.6 DSO Object Destruction API </ a > </ h4 >
38083859
38093860< p >
38103861< a name ="dso-dtor-motivation ">
3811- < h5 > < a href ="#dso-dtor-motivation "> 3.3.5 .1 Motivation </ a > </ h5 >
3862+ < h5 > < a href ="#dso-dtor-motivation "> 3.3.6 .1 Motivation </ a > </ h5 >
38123863
38133864< p >
38143865The C++ Standard requires that destructors be called for global objects
@@ -3832,7 +3883,7 @@ <h5><a href="#dso-dtor-motivation"> 3.3.5.1 Motivation </a></h5>
38323883
38333884< p >
38343885< a name ="dso-dtor-runtime-data ">
3835- < h5 > < a href ="#dso-dtor-runtime-data "> 3.3.5 .2 Runtime Data Structure </ a > </ h5 >
3886+ < h5 > < a href ="#dso-dtor-runtime-data "> 3.3.6 .2 Runtime Data Structure </ a > </ h5 >
38363887
38373888< p >
38383889The runtime library shall maintain a list of termination functions
@@ -3850,7 +3901,7 @@ <h5><a href="#dso-dtor-runtime-data"> 3.3.5.2 Runtime Data Structure </a></h5>
38503901
38513902< p >
38523903< a name ="dso-dtor-runtime-api ">
3853- < h5 > < a href ="#dso-dtor-runtime-api "> 3.3.5 .3 Runtime API </ a > </ h5 >
3904+ < h5 > < a href ="#dso-dtor-runtime-api "> 3.3.6 .3 Runtime API </ a > </ h5 >
38543905
38553906< ol type =A >
38563907< p >
@@ -4510,15 +4561,25 @@ <h5><a href="#mangling-special-ctor-dtor"> 5.1.4.3 Constructors and Destructors
45104561is replaced by one of the following:
45114562
45124563< pre > < font color =blue > < code >
4513- << a name ="mangle.ctor-dtor-name "> ctor-dtor-name</ a > > ::= C1 # complete object constructor
4514- ::= C2 # base object constructor
4515- ::= C3 # complete object allocating constructor
4516- ::= D0 # deleting destructor
4517- ::= D1 # complete object destructor
4518- ::= D2 # base object destructor
4519-
4564+ << a name ="mangle.ctor-dtor-name "> ctor-dtor-name</ a > > ::= C1 # complete object constructor
4565+ ::= C2 # base object constructor
4566+ ::= C3 # complete object allocating constructor
4567+ ::= CI1 << i > base class</ i > < a href ="#mangle.type "> type</ a > > # complete object < a href ="#inh-ctor "> inheriting constructor</ a >
4568+ ::= CI2 << i > base class</ i > < a href ="#mangle.type "> type</ a > > # base object < a href ="#inh-ctor "> inheriting constructor</ a >
4569+ ::= D0 # deleting destructor
4570+ ::= D1 # complete object destructor
4571+ ::= D2 # base object destructor
45204572</ pre > </ font > </ code >
45214573
4574+ < p >
4575+ The << i > base class</ i > < a href ="#mangle.type "> type</ a > > in an inheriting
4576+ constructor mangling identifies the base class in which the inherited
4577+ constructor was originally declared.
4578+
4579+ < p >
4580+ Some of the symbols for constructor and destructor variants are < a
4581+ href ="#vague-ctor "> optional</ a > .
4582+
45224583< p >
45234584< a name ="mangling-special-guards ">
45244585< h5 > < a href ="#mangling-special-guards "> 5.1.4.4 Guard Variables </ a > </ h5 >
@@ -5912,7 +5973,7 @@ <h4><a href="#vague-static"> 5.2.2 Static Data </a></h4>
59125973< p >
59135974Some objects with static storage duration have associated guard variables
59145975used to ensure that they are initialized only once
5915- (see < a href =once-ctor > 3.3.2 </ a > ).
5976+ (see < a href =once-ctor > 3.3.3 </ a > ).
59165977If the object is emitted using a COMDAT group,
59175978the guard variable must be too.
59185979It is suggested that it be emitted in the same COMDAT group as the
@@ -5996,12 +6057,13 @@ <h4><a href="#vague-ctor"> 5.2.5 Constructors and Destructors</a></h4>
59966057or destructor name.
59976058
59986059< p >
5999- This ABI does not require the generation or use of allocating
6000- constructors or deleting destructors for classes without a virtual
6001- destructor. However, if an implementation emits such functions, it
6002- must use the external names specified in this ABI. If such a function
6003- has external linkage, it must be emitted wherever referenced, in a
6004- COMDAT group whose name is the external name of the function.
6060+ This ABI does not require the generation or use of allocating constructors or
6061+ inheriting constructors, and does not require the generation or use of deleting
6062+ destructors for classes without a virtual destructor. However, if an
6063+ implementation emits such functions, it must use the external names specified
6064+ in this ABI. If such a function has external linkage, it must be emitted
6065+ wherever referenced, in a COMDAT group whose name is the external name of the
6066+ function.
60056067
60066068< p >
60076069< a name ="vague-itemplate ">
@@ -6328,32 +6390,32 @@ <h2><a name="revisions">Appendix R: Revision History</a></h2>
63286390 Note about locating virtual bases statically during
63296391 construction (2.6.1).
63306392 Rename IA-64 to Itanium throughout.
6331- Add __cxa_vec_cleanup (3.3.3 ).</ p >
6393+ Add __cxa_vec_cleanup (3.3.4 ).</ p >
63326394
63336395< p class ="revision "> < span class ="date "> [000817]</ span >
63346396 Updates from 17 August meeting, email.</ p >
63356397
63366398< p class ="revision "> < span class ="date "> [000807]</ span >
63376399 Added base document section (1.5).
63386400 Further RTTI field name cleanup (2.9.4).
6339- Update proposed one-time construction API (3.3.2 ).
6340- Update proposed object construction priority API (3.3.4 ).
6401+ Update proposed one-time construction API (3.3.3 ).
6402+ Update proposed object construction priority API (3.3.5 ).
63416403 Removed <name> substitution (5.1.2).
63426404 COMDAT not generally necessary for internal linkage (5.2).
63436405 COMDAT for local static guard variables (5.2.2).</ p >
63446406
63456407< p class ="revision "> < span class ="date "> [000727]</ span >
63466408 Updates from 20 July meeting.
6347- Added section on controlling object construction order (3.3.4 ).</ p >
6409+ Added section on controlling object construction order (3.3.5 ).</ p >
63486410
63496411< p class ="revision "> < span class ="date "> [000707]</ span >
63506412 Introduce consistent type_info field names (2.9.4).
63516413 Removed vmi flags for publicly/non-publicly inherited bases (2.9.4).
63526414 Collect all construction/destruction APIs in one section (3.3).
6353- Added one-time initialization API (3.3.2 ).
6354- Vector construction/destruction routines are extern "C" (3.3.3 ).
6355- Added routines for vector construction/destruction (3.3.3 ).
6356- Added copy construction runtime API (3.3.3 ).
6415+ Added one-time initialization API (3.3.3 ).
6416+ Vector construction/destruction routines are extern "C" (3.3.4 ).
6417+ Added routines for vector construction/destruction (3.3.4 ).
6418+ Added copy construction runtime API (3.3.4 ).
63576419 Make Alex's changes in mangling grammar (5.1).
63586420 Add <special-name> cases for covariant override thunks (5.1.4).
63596421 Allow expressions as array type dimensions (5.1.5).
0 commit comments