April 06 [Issue 24484] New: Generic container's recursive destructor does not compile due to "no size". | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: scrubereal@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`. -- |
Copyright © 1999-2021 by the D Language Foundation