on-internet
← Community

Designated initialization and base classes? [duplicate]

Stack Overflow ·

In C++20 (latest draft), given the following code: struct B { int mb; }; struct D : B { int md; }; which of these six expressions are ill-formed and which are not? /*1*/ D{42, 43} /*2*/ D{{42}, 43} /*3*/ D{42, .md = 43} /*4*/ D{{42}, .md = 43} /*5*/ D{.mb = 42, .md = 43} /*6*/ D{{.mb = 42}, .md = 43}

Comments

Sign in or sign up to comment and upvote.

No comments yet.