www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2501] New: member function marked as final override ignores override requirements

reply d-bugmail puremagic.com writes:
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


-- 
Dec 09 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2501






I think the final is not the problem here. It is ok to final a function that
doesn't override anything.


-- 
Dec 10 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2501






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.


-- 
Dec 11 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2501







It is the case with both attributes set which is
 being interpreted correctly.
*incorrectly --
Dec 11 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2501


bugzilla digitalmars.com changed:

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





Fixed dmd 1.038 amd 2.022


-- 
Dec 25 2008