[Issue 3487] New: [tdpl] Covariant returns needed for typedef

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Nov 7 10:20:05 PST 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3487

           Summary: [tdpl] Covariant returns needed for typedef
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrei at metalanguage.com


--- Comment #0 from Andrei Alexandrescu <andrei at metalanguage.com> 2009-11-07 10:20:03 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list