www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12329] New: override for implementing interfaces is not allowed in a subclass

https://d.puremagic.com/issues/show_bug.cgi?id=12329

           Summary: override for implementing interfaces is not allowed in
                    a subclass
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



06:59:15 PDT ---
This is likely a dupe report but I can't find the report.

-----
module test;

interface I { void foo(); }
class C : I { override void foo() { } }  // ok to use override here
class D : C { override void foo() { } }

class C2 : I  { }
class D2 : C2 { override void foo() { } }  // error

void main() { }
-----

The compiler should be consistent, either disallow override in both cases for C
and D2, or allow them both. But remember this is about *implementing* the
interface function, not overriding it.

Note that the diagnostic is also terrible:

Error: function test.D2.foo does not override any function, did you mean to
override 'test.I.foo'?

But I'm sure I saw this filed somewhere too.

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