Bug 3487 – [tdpl] Covariant returns needed for typedef
Status
RESOLVED
Resolution
WONTFIX
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2009-11-07T10:20:00Z
Last change time
2015-06-09T05:14:57Z
Assigned to
nobody
Creator
andrei
Comments
Comment #0 by andrei — 2009-11-07T10:20:03Z
Consider:
struct A {
A fun() { return A.init; }
}
typedef A B;
void main() {
B b;
B c = b.fun();
}
The return type of a member of A must be automatically cast to B when used through a typedef. This is in order to allow B support the same methods as A. It is also consistent with typedefs of built-in types.