Whats going on with this?

Daniel Kozak kozzi11 at gmail.com
Sat Oct 3 22:12:05 UTC 2020


On Sat, Oct 3, 2020 at 11:30 PM Steven Schveighoffer via
Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

>
>
> "StructMemberInitializers with the NonVoidInitializer syntax appear in
> the lexical order of the fields in the StructDeclaration" seems to
> suggest it will not call the constructor, but instead initialize the
> fields according to the list.
>
> The fields are not a static array, so clearly it is calling the
> constructor, and not initializing the fields.
>
> I really don't think this case is in the spec.
>
> But I know it works, for instance:
>
> Variant v = anything;
>
> If this required an explicit Variant constructor, it would be quite
> annoying.
>
> -Steve
>

Yes you are right
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20201004/954466cc/attachment.htm>


More information about the Digitalmars-d-learn mailing list