Bug 11019 – fwd reference : legal in C++, CT error in D (unable to resolve forward reference in definition)
Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-12T20:25:00Z
Last change time
2015-06-17T21:04:06Z
Assigned to
nobody
Creator
thelastmammoth
Comments
Comment #0 by thelastmammoth — 2013-09-12T20:25:16Z
/*
g++ -c main.cpp #OK
*/
class D;
class A {
public: A* View(){ return (A*)0; }
};
class B : A{
public: D* View() { return (D*)0;}
};
class D : B{ };
----------------
dmd main.d:
Error: class tests.test_multi.B unable to resolve forward reference in definition
(and line number is at class declaration (line HERE) instead of offending location (line HERE+1) )
class A {
public A View(){ return null; }
}
class B : A{ //line HERE
public D View() { return null;}
}
class D : B{ }
Comment #1 by samukha — 2014-02-13T01:11:38Z
Works with dmd 2.065, provided View in B is tagged with 'override'.
Comment #2 by github-bugzilla — 2015-04-02T13:14:32Z