[Issue 10953] New: Attribute inheritance needs to apply to contracts, too

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Sep 2 21:21:26 PDT 2013


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

           Summary: Attribute inheritance needs to apply to contracts, too
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bugzilla at digitalmars.com


--- Comment #0 from Walter Bright <bugzilla at digitalmars.com> 2013-09-02 21:21:24 PDT ---
Kenji reports:

class Foo
{
    void func() nothrow pure @safe
    in {} out {} body {}
}

class Bar : Foo
{
    override void func()    // inherits attributes of Foo.func
    in {} out {} body {}
}


Bar.func reports "cannot call xxx function" error.
 The reason is the two calls of findVtblIndex in FuncDeclaration::semantic. It
would modify the type field if a derived method inherits the attributes of its
base method (This is documented behavior. Read
http://dlang.org/function#virtual-functions if you interest). But it is not
reflected to the local variable TypeFunction *f

See also https://github.com/D-Programming-Language/dmd/pull/2516

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