[Issue 13278] New: Symbol undefined on reference to abstract method

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Aug 10 12:46:44 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=13278

          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 at puremagic.com
          Reporter: blah38621 at 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)
    {

        super.visit(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.

--


More information about the Digitalmars-d-bugs mailing list