D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3487 - [tdpl] Covariant returns needed for typedef
Summary: [tdpl] Covariant returns needed for typedef
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-07 10:20 UTC by Andrei Alexandrescu
Modified: 2015-06-09 05:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andrei Alexandrescu 2009-11-07 10:20:03 UTC
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.
Comment 1 Walter Bright 2009-11-18 10:54:33 UTC
Dropping typedef, so won't fix.