On 03/13/2017 11:58 PM, Stefan Koch wrote:
On Monday, 13 March 2017 at 22:05:24 UTC, Jack Applegame wrote:
Is this a bug?
No it's not
struct C
{
B!C;
}
is an error.
Howto compute C ? <------\
let's check the members; |
The member needs a template. |
Howto compute the template ? |
let's compute the parameters. |
What is the first Parameter ? |
Its C. |
Howoto compute C -------/
I don't think that's it.
Here's a variant where B is not instantiated with C:
----
struct A()
{
~this() { enum s = C.sizeof; }
}
struct B() { A!() foo; }
struct C { B!() bar; }
----
How to compute C?
Check members.
For member `B!() bar;`, resolve `B!()`.
Check members of `B!()`.
For member `A!() foo;` resolve `A!()`.
Check members of `A!()`.
No members => size = 0 (or rather 1, I guess).
Bubble up.
But the compiler seems to get confused by the destructor. I guess it
incorrectly(?) sees a need to analyze C again before it can finish up
`A!()`?