Bug 3834 – forward reference in templated class

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-02-18T13:00:00Z
Last change time
2013-11-22T02:02:45Z
Keywords
rejects-valid
Assigned to
nobody
Creator
bearophile_hugs
Blocks
340

Comments

Comment #0 by bearophile_hugs — 2010-02-18T13:00:53Z
class Foo(T) { Node!T head; class Node(T) {} } void main() { auto f = new Foo!int; } dmd prints: test.d(2): Error: template instance Node!(int) forward references template declaration Node(T) test.d(2): Error: Node!(int) is used as a type test.d(2): Error: variable test.Foo!(int).Foo.head voids have no value test.d(6): Error: template instance test.Foo!(int) error instantiating
Comment #1 by bearophile_hugs — 2010-04-10T16:14:55Z
A simpler case example: struct Foo(T) { Node!T head; struct Node(T) {} } void main() { Foo!int f; } dmd 2.043 prints many errors: test.d(2): Error: template instance Node!(int) forward references template declaration Node(T) test.d(2): Error: Node!(int) is used as a type test.d(2): Error: variable test.Foo!(int).Foo.head voids have no value test.d(6): Error: template instance test.Foo!(int) error instantiating
Comment #2 by k.hara.pg — 2013-11-22T02:02:45Z
The first case in comment#0 was fixed in 2.064, by fixing issue 10583. The second case in comment #1 was fixed in 2.059.