16-01-2026, 01:09 PM
Hi,
For the following code, to the best of our knowledge, the C++ standard guarantees that m1 and m2 are both properly initialized when creating an object of type C ([class.base.init]p9 and [dcl.init]p7).
However, being strict with the amplification given for rule 15.1.4, data member m2 cannot be considered initialized: neither is C() delegating, nor does m2 have a default member initializer, nor does it appear in the member initialization list, nor does its (array) type feature a constructor.
m1 is considered initialized as its type M has a constructor.
We think the code example should be compliant, but the rule amplification wording seems incomplete.
Can you confirm this interpretation or do we miss a reason for this code to be non-compliant w.r.t. 15.1.4?
Thanks in advance!
For the following code, to the best of our knowledge, the C++ standard guarantees that m1 and m2 are both properly initialized when creating an object of type C ([class.base.init]p9 and [dcl.init]p7).
Code:
class M { M() {} };
class C {
M m1;
M m2[2];
C() {}
};However, being strict with the amplification given for rule 15.1.4, data member m2 cannot be considered initialized: neither is C() delegating, nor does m2 have a default member initializer, nor does it appear in the member initialization list, nor does its (array) type feature a constructor.
m1 is considered initialized as its type M has a constructor.
We think the code example should be compliant, but the rule amplification wording seems incomplete.
Can you confirm this interpretation or do we miss a reason for this code to be non-compliant w.r.t. 15.1.4?
Thanks in advance!

