Bug 24484 – Generic container's recursive destructor does not compile due to "no size".

Status
NEW
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2024-04-06T04:47:47Z
Last change time
2024-12-13T19:34:28Z
Assigned to
No Owner
Creator
scrubereal
Moved to GitHub: dmd#20435 →

Comments

Comment #0 by scrubereal — 2024-04-06T04:47:47Z
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`.
Comment #1 by robert.schadek — 2024-12-13T19:34:28Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20435 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB