Bug 8990 – Forward reference error on three structs

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-09T22:05:00Z
Last change time
2012-11-13T13:09:11Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
bus_dbugzilla
Blocks
340

Comments

Comment #0 by bus_dbugzilla — 2012-11-09T22:05:34Z
From digitalmars.D.learn: http://forum.dlang.org/thread/[email protected] struct A(T) { T t; } struct B(T) { A!(T)* a; } struct C { B!(C)* b; } Result: test.d(2): Error: struct test.A!(C).A has forward references test.d(11): Error: template instance test.B!(C) error instantiating Workaround: Inside the definition of "struct B(T)", move "A!(T)" to an optional template parameter: struct B(T, U=A!(T)) { U* a; } This *might* be related to #6969, but I'm not sure.
Comment #1 by alanb — 2012-11-09T23:06:12Z
> > This *might* be related to #6969, but I'm not sure. Also appears to be related, if not identical, to this one http://d.puremagic.com/issues/show_bug.cgi?id=3834
Comment #2 by alanb — 2012-11-09T23:12:29Z
(In reply to comment #1) > > > > This *might* be related to #6969, but I'm not sure. > > Also appears to be related, if not identical, to this one > http://d.puremagic.com/issues/show_bug.cgi?id=3834 Scratch that, #3834 is not related to this one at all.
Comment #3 by clugdbug — 2012-11-12T07:07:59Z
Yes, looks identical to bug 6969 to me.
Comment #4 by k.hara.pg — 2012-11-13T04:19:13Z
Comment #5 by bus_dbugzilla — 2012-11-13T08:31:51Z
@Don: FWIW, The reason I wasn't sure if this was the same was because if you take the #6969 test case and replace all the "class" with "struct", it works. But, of course, Hara's pull apparently fixes both, so all the better :)
Comment #6 by github-bugzilla — 2012-11-13T12:27:42Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/821fddfcd8188cf28ce379cdcf537fb2931a1d3d fix Issue 8990 - Forward reference error on three structs https://github.com/D-Programming-Language/dmd/commit/c34c5fb0e67f7c48bb683ef409378fde6db33088 Merge pull request #1280 from 9rnsr/fix8990 Issue 6969 & 8990 - Forward reference error between three template instantiations