Bug 20913 – Array "forward reference" error

Status
NEW
Severity
critical
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-06-09T12:30:17Z
Last change time
2024-12-01T16:36:54Z
Keywords
pull, rejects-valid
Assigned to
No Owner
Creator
Puneet Goel
See also
https://issues.dlang.org/show_bug.cgi?id=23598
Moved to GitHub: phobos#9796 →

Comments

Comment #0 by puneet — 2020-06-09T12:30:17Z
Compiling the following code gives me: Error: unable to determine fields of `Foo` because of forward references import std.container: Array; struct Foo { Array!Bar _barA; } struct Bar { Frop _frop; } class Frop { Array!Foo _foos; }
Comment #1 by b2.temp — 2020-06-13T10:46:58Z
Somewhat reduced: --- import std.traits; struct Array(T) { static if (hasIndirections!T) {} } struct Foo { Array!Bar _barA; } struct Bar { Frop _frop; } class Frop { Array!Foo _foos; } --- The problem is caused by the call to `hasIndirections` and to a nested call to `isDynamicArray`. changing the `isDynamiArray` implementation from: enum bool isDynamicArray(T) = is(DynamicArrayTypeOf!T) && !isAggregateType!T; to enum isDynamicArray(T) = !isAggregateType!T && is(DynamicArrayTypeOf!T); allows to compile without error but without really fixing the root of the problem, which seems to reside in `DynamicArrayTypeOf`.
Comment #2 by dlang-bot — 2023-01-16T01:26:07Z
@ibuclaw created dlang/dmd pull request #14826 "dmd.aggregate: Define importAll override for AggregateDeclaration" fixing this issue: - fix Issue 20913 - Array "forward reference" error https://github.com/dlang/dmd/pull/14826
Comment #3 by robert.schadek — 2024-12-01T16:36:54Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/9796 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB