Thread overview
[Issue 1909] New: final classes' methods that don't override anything shouldn't be virtual
Mar 12, 2008
d-bugmail
Sep 18, 2009
Stewart Gordon
Sep 18, 2009
Matti Niemenmaa
March 12, 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@digitalmars.com
        ReportedBy: thecybershadow@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.


-- 

September 18, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1909


Stewart Gordon <smjg@iname.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com


--- Comment #1 from Stewart Gordon <smjg@iname.com> 2009-09-18 04:06:36 PDT ---
This should also apply to methods that are declared final, whether in a final class or not.  What happens here at the moment?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 18, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1909


Matti Niemenmaa <matti.niemenmaa+dbugzilla@iki.fi> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |matti.niemenmaa+dbugzilla@i
                   |                            |ki.fi
         Resolution|                            |DUPLICATE


--- Comment #2 from Matti Niemenmaa <matti.niemenmaa+dbugzilla@iki.fi> 2009-09-18 06:12:59 PDT ---
Looks like I managed to report a duplicate of this, #2326, which then got fixed in 1.037.

*** This issue has been marked as a duplicate of issue 2326 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------