www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13278] New: Symbol undefined on reference to abstract method


          Issue ID: 13278
           Summary: Symbol undefined on reference to abstract method
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: blah38621 gmail.com

Currently the following code will cause the linker to complain about not being 
able to find Visitor.visit(Object).

module main;

abstract class Visitor
    abstract void visit(Object o);

final class SomeVisitor : Visitor
    override void visit(Object o)


void main()


I believe that this should either be caught as an error by the compiler, or 
else, preferably, the compiler should simply not generate a call to the body of 
the base abstract method. The reason I believe that this should function that 
way is so that SomeVisitor.visit is not dependent on the exact implementation 
of Visitor. If you wanted to add some type of profiling or debugging output in 
the base class, and you weren't allowed to call super.visit on an abstract 
method without a body, then you'd have to go through each and every visitor and 
add the super.visit call, and then remove it again once you want to remove that 
profiling or debugging output. That would not be practical in any sense, thus 
my view of it.

Aug 10 2014