Title
Zero- and default-initialization of cv-qualified std::meta::info
Status
tentatively ready
Section
9.5.1 [dcl.init.general]
Submitter
Jiang An

Created on 2026-06-10.00:00:00 last changed 5 days ago

Messages

Date: 2026-06-26.22:53:47

Proposed resolution (approved by CWG 2026-06-26):

  1. Change in 9.5.1 [dcl.init.general] paragraph 6 as follows:

    To zero-initialize an object or reference of type cv T means:
    • if T is std::meta::info, the object is initialized to a null reflection value;
    • if T is any other scalar type (6.9.1 [basic.types.general]), the object is initialized to the value obtained by converting the integer literal 0 (zero) to T; [ Footnote: ... ]
    • if T is a (possibly cv-qualified) non-union class type, its padding bits (6.9.1 [basic.types.general]) are initialized to zero bits and each non-static data member, each non-virtual base class subobject, and, if the object is not a base class subobject, each virtual base class subobject is zero-initialized;
    • if T is a (possibly cv-qualified) union type, its padding bits (6.9.1 [basic.types.general]) are initialized to zero bits and the object's first non-static named data member is zero-initialized;
    • if T is an array type, each element is zero-initialized;
    • if T is a reference type, no initialization is performed.
  2. Change in 9.5.1 [dcl.init.general] paragraph 7 as follows:

    To default-initialize an object of type cv T means:
    • If T is a (possibly cv-qualified) class type (Clause Clause 11 [class]), constructors are considered. The applicable constructors are enumerated (12.2.2.4 [over.match.ctor]), and the best one for the initializer () is chosen through overload resolution (12.2 [over.match]). The constructor thus selected is called, with an empty argument list, to initialize the object.
    • If T is an array type, the semantic constraints of default-initializing a hypothetical element shall be met and each element is default-initialized.
    • If T is std::meta::info, the object is zero-initialized.
    • Otherwise, no initialization is performed.
Date: 2026-06-10.00:00:00

(From submission #920.)

Subclauses 9.5.1 [dcl.init.general] bullet 6.1 and 9.5.1 [dcl.init.general] bullet 7.3 do not, but ought to, handle cv-qualified std::meta::info.

History
Date User Action Args
2026-06-26 22:53:47adminsetstatus: open -> tentatively ready
2026-06-22 21:26:03adminsetmessages: + msg8606
2026-06-10 00:00:00admincreate