December 06, 2023 [Issue 24270] New: Pointer to Nullable of recursive struct | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24270 Issue ID: 24270 Summary: Pointer to Nullable of recursive struct Product: D Version: D2 Hardware: x86 OS: Linux Status: NEW Severity: minor Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: alexandre.bourquelot@ahrefs.com ``` import std.typecons; struct RecursiveClass { int id; bool flag; Nullable!(RecursiveClass)* children; } ``` This does not compile because the compiler is unable to infer the size of the struct, but given that the third member is a pointer, it should work. ``` /usr/lib/ldc/x86_64-linux-gnu/include/d/core/internal/traits.d(345): Error: unable to determine fields of `RecursiveClass` because of forward references /usr/lib/ldc/x86_64-linux-gnu/include/d/std/traits.d(3343): Error: template instance `core.internal.traits._hasIndirections!(RecursiveClass)` error instantiating ``` -- |
Copyright © 1999-2021 by the D Language Foundation