[Issue 1909] New: final classes' methods that don't override anything shouldn't be virtual

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Mar 11 17:48:04 PDT 2008


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

           Summary: final classes' methods that don't override anything
                    shouldn't be virtual
           Product: D
           Version: 1.024
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: minor
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: thecybershadow at gmail.com


test case:

final class C
{
        void m()
        {
        }
}

void main()
{
        (new C).m;
}


Examining the generated code shows that m is a virtual function, and called
using the class's Vtable. Needless to say, this is an unneeded slowdown.


-- 



More information about the Digitalmars-d-bugs mailing list