[Issue 3252] undefined reference to package function called from an interface

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jan 22 12:10:11 PST 2013


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


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |andrej.mitrovich at gmail.com
         Resolution|                            |INVALID


--- Comment #5 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-01-22 12:10:09 PST ---
package methods are non-virtual, so you're not overriding iPack here but
instead introducing a new function in the 'A' class. 'I.pack' is an externally
defined final function, which is why linking fails. If you define a body for
'I.pack' you will see that the compiler won't complain about an interface
method having an implementation, because package (i.e. non-virtual) methods are
allowed in interfaces.

The compiler currently doesn't complain about having a function in the base
class (or interface) having the same name as the one defined in the current
class:

class B
{
    package void iPack()
    {
    }
}

class A : B
{
    package void iPack()  // no errors, neither in D1 or D2
    {
    }
}

But that is a separate issue which would be an enhancement request (I think
there are some opened ones about this).

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