www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10953] New: Attribute inheritance needs to apply to contracts, too

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bugzilla digitalmars.com



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: -------
Sep 02 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10953


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull, rejects-valid




 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
The bug occurs when -profile switch is specified. Compiler fix: https://github.com/D-Programming-Language/dmd/pull/2521 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 02 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10953




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/44d95dda97870d372c3c7246cf21e614c72e2a61
fix Issue 10953 - Attribute inheritance needs to apply to contracts, too

https://github.com/D-Programming-Language/dmd/commit/a4d5392763e90ff4400495030a2cec8b498d3908


Issue 10953 - Attribute inheritance needs to apply to contracts, too

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 02 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10953


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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