[Issue 24484] New: Generic container's recursive destructor does not compile due to "no size".
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Apr 6 04:47:47 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=24484
Issue ID: 24484
Summary: Generic container's recursive destructor does not
compile due to "no size".
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: scrubereal at gmail.com
struct Array(E) {
E[] elements;
~this() {
foreach (e; this.elements) e.destroy();
}
}
struct Node {Object value;}
struct Object {Array!Node values;}
> issue.d(5): Error: struct `issue.Node` no size because of forward reference
Actions that suppress the issue:
- removing the line of code in the destructor's body
- changing `~this()` to `void destroy()` and calling it manually
- removing the type parameter and replacing `E` by `Node`
- moving `Object.values` into `Node`.
--
More information about the Digitalmars-d-bugs
mailing list