[Issue 5450] New: no match for implicit super() call in constructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 13 06:13:52 PST 2011


http://d.puremagic.com/issues/show_bug.cgi?id=5450

           Summary: no match for implicit super() call in constructor
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: mrmocool at gmx.de


--- Comment #0 from Trass3r <mrmocool at gmx.de> 2011-01-13 06:12:02 PST ---
class Foo
{
    this(float f) {}
}

class Bar : Foo
{
    this(int i) {}
}

-> foo.d(8): Error: constructor foo.Bar.this no match for implicit super() call
in constructor

Adhering to the spec, dmd silently inserts a super() call in Bar's constructor
as soon as its base class Foo has *a* constructor. But there is no this()
without arguments in Foo.

This always requires me to put a bugging this() {} into Foo.

Why can't dmd just generate an empty this(){} in this case?
I mean it also does it the other way around:

"If there is no constructor for a class, but there is a constructor for the
base class, a default constructor of the form: this() { } is implicitly
generated."

(Though the spec could be clearer here, does this also mean that a super() call
is inserted into this newly generated this()?)

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


More information about the Digitalmars-d-bugs mailing list