[Issue 23414] Import order emits "Error: no size because of forward references"
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 29 19:18:44 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=23414
Max Samukha <maxsamukha at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |maxsamukha at gmail.com
--- Comment #6 from Max Samukha <maxsamukha at gmail.com> ---
(In reply to Walter Bright from comment #4)
> struct S
> {
> static if (S.sizeof == 0)
> {
> int x;
> }
> }
>
> It's impossible for the compiler to resolve it. While the example looks
> trivial and ridiculous, sometimes these cases are hidden behind a thicket of
> complex templates.
>
While there is often a real circular dependence, D still fails in many cases
when there is not, like:
```
struct S(alias self)
{
alias Outer = __traits(parent, self);
ref Outer outer() => *cast(Outer*)(cast(ubyte*)&this - self.offsetof);
}
struct S2
{
S!s s;
}
```
Error: circular reference to variable `a.S2.s
It would be immensely cool if that worked.
--
More information about the Digitalmars-d-bugs
mailing list