Instantiation of nested structs should be allowed outside their parent scope

Stanislav Blinov stanislav.blinov at gmail.com
Tue Nov 9 19:00:38 UTC 2021


On Tuesday, 9 November 2021 at 18:35:44 UTC, Alexandru Ermicioi 
wrote:

> If compiler can help in preventing potential bugs...

That's just the thing. That error message is, plain and simple, 
handwaving. Unless, like I said already, I'm missing something. 
The compiler is perfectly happy with me initializing a nested 
struct to its .init value. But instantiating it elsewhere - 
nuuuh, that's not allowed!

> The problem from discussion in this thread seems to be due to 
> bugs in how copy constructor is implemented, therefore first 
> thing would be best to do, is to file a bug report. After this 
> you can try fix it yourself, wait for other person do it, or 
> motivate people in doing it.

Please, this is not helpful. There are already reports on this, 
including ones filed by myself. Why do you think I created this 
topic?

> Imho this is not a minor thing, and should be fixed quite fast. 
> In meantime, you could try make inner struct static. This 
> should eliminate the context pointer.

That is not "inner" struct. That is nested struct. And the whole 
point of this topic *is* nested structs. I don't need to 
eliminate context pointer. I need generic code to work with 
nested structs. Including the copy tests being discussed here. 
Including, for gods sake, Phobos ranges.


More information about the Digitalmars-d mailing list