`typeof` forward ref fails whereas explicit type passes

user1234 user1234 at 12.de
Mon Apr 27 08:24:45 UTC 2026


Just noticed a bug at Odin GH and it turns out D is affected as 
well:

```d
// NG
S0 s0;
struct S0
{
     typeof(s0)* next;
}

// OK
S2 s2;
struct S2
{
     S2* next;
}

// OK
struct S1
{
     typeof(s1)* next;
}
S1 s1;
```

> temp.d(2,4): Error: cannot declare field `s0` because it will 
> change the determined size of `S0`



More information about the Digitalmars-d-learn mailing list