www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21653] New: Inheriting from an interface then a class


          Issue ID: 21653
           Summary: Inheriting from an interface then a class generates a
                    wrong error
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: industry, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: pro.mathias.lang gmail.com

interface A {}
class C { int a; }

class Works : C, A {}
class Doesnt : A, C {}

This seems like a pointless limitation. It produces the following error:
multi.d(5): Error: multi.Doesnt: multiple class inheritance is not supported.
Use multiple interface inheritance and/or composition.
multi.d(5):        multi.C has fields, consider making it a member of

Feb 21 2021