[Issue 24270] New: Pointer to Nullable of recursive struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Dec 6 01:59:02 UTC 2023
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 at puremagic.com
Reporter: alexandre.bourquelot at 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
```
--
More information about the Digitalmars-d-bugs
mailing list