Bug 22434 – Nested struct or not nested struct?

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-10-25T14:00:53Z
Last change time
2024-12-13T19:18:50Z
Assigned to
No Owner
Creator
Stanislav Blinov
Moved to GitHub: dmd#19995 →

Comments

Comment #0 by stanislav.blinov — 2021-10-25T14:00:53Z
struct Storage(T) { T[1] items; this(T[] arr) { // Error: field `items` must be initialized in constructor, because it is nested struct /* ... */ } } void test() { struct Cat { ~this() {} // nested } struct Box { Cat cat; } //static assert(__traits(isNested, Box)); // would fail if uncommented Storage!Box storage; } --- Cat is nested. Box contains Cat, has no explicitly defined methods, but does have __xdtor due to Cat. Does not appear as a nested struct through __traits, but stumps Storage's ctor "because it is nested struct".
Comment #1 by robert.schadek — 2024-12-13T19:18:50Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19995 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB