Bug 2654 – Forward reference error with array of struct and circular import

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-02-10T15:04:00Z
Last change time
2015-06-09T01:21:01Z
Keywords
rejects-valid
Assigned to
nobody
Creator
someanon
Depends on
2386
Blocks
340

Attachments

IDFilenameSummaryContent-TypeSize
288dmd-dep-bug.tgzthe source code.application/x-compressed-tar340

Comments

Comment #0 by someanon — 2009-02-10T15:04:31Z
http://www.digitalmars.com/d/archives/digitalmars/D/circular_deps_53496.html But according to the specs the compiler is indeed buggy. The specs say: | The order in which ImportDeclarations occur has no significance. //main.d --------------8<--------------- import vec3, mat3, quat; int main() { return 0; } // mat3.d--------------8<--------------- module mat3; import vec3, quat; struct Mat3 { Vec3[3] m; } // quat.d--------------8<--------------- module quat; import vec3, mat3; struct Quat {} // vec3.d--------------8<--------------- module vec3; import mat3, quat; struct Vec3 { } I get this back from the compiler.... unixbox$ dmd main.d vec3.d mat3.d quat.d vec3.d(6): struct vec3.Vec3 no size yet for forward reference vec3.d(6): struct vec3.Vec3 no size yet for forward reference vec3.d(6): struct vec3.Vec3 no size yet for forward reference unixbox$
Comment #1 by someanon — 2009-02-10T15:06:38Z
Created attachment 288 the source code.
Comment #2 by smjg — 2009-02-15T19:48:50Z
Please remember to assign keywords to bug reports. To everybody reading this: Please look through issues you've reported and check for missing keywords. Moreover, what was the point of the attachment when you've already posted the code? What's more, it's so small that by gzipping it you've actually made it bigger than the original files! Anyway, this seems to be closely related to issue 2386....
Comment #3 by r.sagitario — 2010-03-27T06:18:36Z
Although the test case looks a bit different, the patch for #2386 also fixes this issue
Comment #4 by bearophile_hugs — 2010-05-15T17:58:28Z
Fixed in dmd v1.061 and v2.046.