Instantiation of nested structs should be allowed outside their parent scope
Stefan Koch
uplink.coder at googlemail.com
Tue Nov 9 01:06:16 UTC 2021
On Monday, 8 November 2021 at 01:02:11 UTC, Stanislav Blinov
wrote:
> Just make it `@system`, and even then ONLY if something is
> actually getting instantiated and it's not just a CTFE test.
> Unless I'm missing something, that should be the behavior. The
> 'cannot access frame pointer' blah SO needs to go away...
>
> Rationale: instantiating things is super useful for compile
> time tests and inference. Nested structs complicate that to
> wazoo with that failure.
>
> If you're not convinced, I encourage you to try and define e.g.
>
> ```d
> enum bool isNothrowCopyable(To, From) = /* ??? */
> ```
>
> without reimplementing copy initialization by hand. It should
> be a trivial test. Just test copy-initialization of a union
> field. But no. Not when nested structs are involved. And they
> can get involved indirectly.
How would you want a struct to behave when it is used outside of
it's context?
Set the context pointer to null and throw upon access?
More information about the Digitalmars-d
mailing list