You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit be1a2e3
Browse filesBrowse the repository at this point in the historyBrowse files
Mark the zeroed members of a value-initialized class as initialized [GH #90]
Value initialization of a class without a user-provided default
constructor zero-initializes the object before calling the constructor.
The interpreter cleared the storage but did not record the subobjects as
initialized, so reading a member that the constructor does not set was
rejected in a constant expression:
struct A { constexpr A() {} int x; };
struct B : A { int y; };
static_assert(B().x == 0); // Previously rejected.
The constructor-call setup in interpret.c now uses init_subobject_to_zero
for such classes. Classes with a user-provided default constructor are
cleared as before, but not marked.
This is needed by the next commit, which stops treating every member of a
class prvalue as initialized; without it, "B().y" above would be rejected
as well (Clang's dcl.init.general/p16-cxx20, GH69890).
Updated expectations: gnu cpp2a/constexpr-init18 now passes; clang
dcl.init.general/p16-cxx20, SemaCXX/constexpr-value-init and
class.inhctor.init/p1 no longer report false errors.
0 commit comments