Thread overview
[Issue 2501] New: member function marked as final override ignores override requirements
Dec 09, 2008
d-bugmail
Dec 11, 2008
d-bugmail
Dec 11, 2008
d-bugmail
Dec 11, 2008
d-bugmail
Dec 25, 2008
d-bugmail
December 09, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2501

           Summary: member function marked as final override ignores
                    override requirements
           Product: D
           Version: 1.037
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: schveiguy@yahoo.com


example:

class C
{
    final override void foo(){}
}

This should fail to compile, because foo is not overriding any virtual function.  A final function is allowed to override a virtual function to stop overriding in derived classes, and to help performance.

Also happens on D 2.019


-- 

December 11, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2501





------- Comment #1 from bugzilla@digitalmars.com  2008-12-11 01:13 -------
I think the final is not the problem here. It is ok to final a function that doesn't override anything.


-- 

December 11, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2501





------- Comment #2 from schveiguy@yahoo.com  2008-12-11 10:01 -------
The two attributes are orthogonal.

final means "nobody who derives from me can override this function"

override means "this function *must* override a base function"

All four cases are valid.  It is the case with both attributes set which is being interpreted correctly.  I don't think final should mask override.


-- 

December 11, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2501





------- Comment #3 from schveiguy@yahoo.com  2008-12-11 10:02 -------
(In reply to comment #2)
>It is the case with both attributes set which is
> being interpreted correctly.

*incorrectly


-- 

December 25, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2501


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #4 from bugzilla@digitalmars.com  2008-12-25 04:40 -------
Fixed dmd 1.038 amd 2.022


--