[Issue 4030] New: Better object array literal type inference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 30 02:59:09 PDT 2010


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

           Summary: Better object array literal type inference
           Product: D
           Version: future
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-03-30 02:59:07 PDT ---
In the following D2 program the compiler can refuse the line 6, because it must
refuse to guess (if p1 is an array of A or B).

But at line 7 the compiler has enough information to not guess (it's an array
of A), so line 7 can be accepted by the compiler:


class A {}
class B : A {}
final class C1 : B {}
final class C2 : B {}
void main() {
    auto p1 = [new C1, new C2]; // line 6, don't guess
    A[]  p2 = [new C1, new C2]; // line 7, no need to guess
}

-- 
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