The following code doesn't compile:
struct S
{
Nullable!S delegate() f;
}
Output from DMD:
/dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/traits.d(345): Error: unable to determine fields of `S` because of forward references
/dlang/dmd/linux/bin64/../../src/phobos/std/traits.d(3327): Error: template instance `core.internal.traits._hasIndirections!(S)` error instantiating
/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(2768): instantiated from here: `hasIndirections!(S)`
onlineapp.d(4): instantiated from here: `Nullable!(S)`
/dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/traits.d(16): Error: unable to determine fields of `S` because of forward references
/dlang/dmd/linux/bin64/../../src/druntime/import/core/internal/traits.d(269): Error: template instance `core.internal.traits.Fields!(S)` error instantiating
/dlang/dmd/linux/bin64/../../src/phobos/std/typecons.d(2790): instantiated from here: `hasElaborateDestructor!(S)`
onlineapp.d(4): instantiated from here: `Nullable!(S)`
I'm not sure whether it's a big in Nullable or in compiler because pragma(msg, S.sizeof)
doesn't work either.
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.