[Issue 2894] New: abstract classes sometimes allow non-abstract bodyless functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Apr 25 00:06:04 PDT 2009


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

           Summary: abstract classes sometimes allow non-abstract bodyless
                    functions
           Product: D
           Version: 1.043
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: kamm-removethis at incasoftware.de


This compiles and links

abstract class C { void foo(); }
void main() {}

while this doesn't

interface I { void foo(); }
abstract class C : I { void foo(); }
void main() {}

with an undefined reference to `_D7abstfun1C3fooMFZv'.

Since methods in abstract classes may have bodies and being allowed to
implement a member function elsewhere than the class definition is a goal (see
resolution of bug 1289), the first case should also require a definition for
foo. This is also what I would expect from reading the spec on abstract
functions and classes.


-- 



More information about the Digitalmars-d-bugs mailing list