Paul Backus snarwin at
Sun Feb 26 23:00:21 UTC 2023

On Sunday, 26 February 2023 at 14:17:50 UTC, ryuukk_ wrote:
> On Sunday, 26 February 2023 at 07:11:55 UTC, Paul Backus wrote:
>> Since `Expression` contains `Binary` and `Unary`, and `Binary` 
>> and `Unary` contain `Expression`, that means `Expression` 
>> contains itself--which is not allowed, because it would result 
>> in `Expression.sizeof` being infinite.
> It should display the proper error message then

Normally when you do this you *will* get a proper error message. 
For example, attempting to compile the following program:

     import std.sumtype;

     alias Test = SumType!S;

     struct S
         Test st;

...will give you this error message:

     /usr/include/dmd/phobos/std/sumtype.d(309): Error: union 
`std.sumtype.SumType!(S).SumType.Storage` no size because of 
forward reference
     forum.d(3): Error: template instance 
`std.sumtype.SumType!(S)` error instantiating

I'm not sure why OP didn't get a proper error message. It's 
possible that there's some other issue with their code that stops 
the error message from being printed. I did not attempt to 
reproduce their error myself.

More information about the Digitalmars-d-learn mailing list