Is this a bug in Nullable or in compiler?

Steven Schveighoffer schveiguy at gmail.com
Mon Nov 28 20:05:09 UTC 2022


On 11/28/22 6:07 AM, Andrey Zherikov wrote:
> The following code doesn't compile:
> ```d
> struct S
> {
>      Nullable!S delegate() f;
> }
> ```

> I tried different variants like `function` instead of `delegate` and 
> putting `Nullable` to parameters like `void function(Nullable!S) f;` - 
> but they don't work either.

It's just a forward reference bug.

This seems to fix it:

```d
alias NS = Nullable!S;
struct S
{
    Nullable!S delegate() f;
}
```

-Steve


More information about the Digitalmars-d mailing list