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

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


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


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

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


--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2013-09-02 21:45:07 PDT ---
(In reply to comment #0)
> 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: -------


More information about the Digitalmars-d-bugs mailing list