C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fixing Inheritance of Constructors from Aggregate bases

From: Barry Revzin <barry.revzin_at_[hidden]>
Date: Tue, 9 Apr 2024 11:55:25 -0500
On Tue, Apr 9, 2024 at 9:42 AM Bjorn Reese via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 4/7/24 18:33, Barry Revzin wrote:
>
> > If we're talking about my paper, then no it shouldn't work. But
> > B<int>{.a=1} should and would initialize the A<int>::a subobject to 0
> > and the direct B<int>::a to 1 (in the wording there, the A<int>::a
> > subobject isn't a designatable member because b.a wouldn't name it).
>
> My question was about David Ledger's proposal.
>

David's proposal is about how we deal with inheriting constructors in the
context of aggregate initialization. Your example didn't have an inherited
constructor, so it would not have any effect.

As far as I can tell, what David's proposal A intends to be is that
inherited constructors simply do not count for the purposes of determining
aggregate status. That is:

> An aggregate is an array or class with no user-declared <del>or
inherited</del> constructors [...]

Note that this wording came from P0017, which is what added the ability to
have base classes as aggregates. I don't see any discussion of inherited
constructors in that paper. It just adds that restriction (which previously
did not apply). Paper should probably note that.

Barry

Received on 2024-04-09 16:55:39