Instantiation of nested structs should be allowed outside their parent scope

Timon Gehr timon.gehr at gmx.ch
Tue Nov 9 16:05:14 UTC 2021


On 09.11.21 16:59, Stanislav Blinov wrote:
> On Tuesday, 9 November 2021 at 15:55:14 UTC, Timon Gehr wrote:
> 
>> It indeed seems ridiculous that you can't copy a nested struct using 
>> its copy constructor. I guess one solution would be to use the frame 
>> pointer of the instance you are about to copy to call the copy 
>> constructor.
>>
>> I don't think calling it with `null` is a great idea.
> 
> Thing is you're not calling it with null. AFAIK, the compiler blits the 
> context first, then calls the ctor.

Well, that's what it should do, but it seems what actually happens is 
that compilation fails instead because the compiler thinks it needs a 
context from somewhere else to create a new instance. This seems like a 
bug to me.


More information about the Digitalmars-d mailing list