www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10940] New: Interface post-condition breaks sub-interface covariance.

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

           Summary: Interface post-condition breaks sub-interface
                    covariance.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jeremiep gmail.com


--- Comment #0 from Jeremie Pelletier <jeremiep gmail.com> 2013-09-01 10:39:59
PDT ---
This code triggers the bug:

    interface A1 { A1 f() out(o) { assert(o !is null); } }
    interface A2 : A1 { override A2 f(); }

making the compiler output the following:

    Error: cast(const(A1))__result is not an lvalue

However, it compiles fine if I either remove the contract or change A2 to a
class.

I'm using DMD 2.063.2 on OS X Lion.

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