Instantiation of nested structs should be allowed outside their parent scope

Timon Gehr timon.gehr at gmx.ch
Tue Nov 9 15:42:13 UTC 2021


On 09.11.21 16:30, Stanislav Blinov wrote:
> I mean, we can freely instantiate null delegates, but we can't 
> instantiate nested structs?

You can get the "null" instance:

auto foo(int x){
     struct S{ int t(){ return x; } }
     return S();
}

void main(){
     // typeof(foo(0)) s; // error
     auto s=typeof(foo(0)).init; // ok
}


More information about the Digitalmars-d mailing list