Struct literals limitation

Jack Applegame japplegame at gmail.com
Mon Nov 16 10:22:49 UTC 2020


Why doesn't it compile?
> auto foo() {
>     struct Foo {
>         int a, b;
>     }
>     return Foo({
>         a: 10,
>         b: 20
>     });
> }

Valid C++14:
> auto foo() {
>     struct Foo {
>         int a, b;
>     };
>     return Foo({
>         .a = 10,
>         .b = 20
>     });
> }



More information about the Digitalmars-d mailing list