Mutually recursive template expansion
jfondren
julian.fondren at gmail.com
Fri Oct 1 14:26:39 UTC 2021
On Friday, 1 October 2021 at 14:03:06 UTC, Stephen wrote:
> This code should work should mutual recursion be supported.
It still wouldn't work, because structs are value types and it's
impossible to say how large either struct is:
Error: struct `mutualrec.Ar` no size because of forward reference
With s/struct/class/ it still wouldn't work because this is a
mixin problem rather than a problem of template mutual recursion:
```d
mixin(q{ class Ar { Br b; } });
mixin(q{ class Br { Ar b; } });
```
mutualrec2.d-mixin-1(1): Error: undefined identifier `Br`, did
you mean class `Ar`?
This seems like a surprising limitation of mixin, though, which
isn't highlighted by the spec.
More information about the Digitalmars-d-learn
mailing list