Struct literals limitation
Dennis
dkorpel at gmail.com
Mon Nov 16 10:51:38 UTC 2020
On Monday, 16 November 2020 at 10:22:49 UTC, Jack Applegame wrote:
> Why doesn't it compile?
>> auto foo() {
>> struct Foo {
>> int a, b;
>> }
>> return Foo({
>> a: 10,
>> b: 20
>> });
>> }
Because in-place struct initialization has never been
implemented. Once the named parameters DIP is implemented, you
should be able to do that by removing the {}:
https://github.com/dlang/DIPs/blob/master/DIPs/accepted/DIP1030.md
More information about the Digitalmars-d
mailing list