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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 13 07:02:17 PST 2011


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2011-01-13 07:00:28 PST ---
As soon as you add a constructor to Foo, you disable the implicit constructor.
So it's correct for the compiler to complain.
Probably the wording of the error message could be improved, but I don't think
this is a rejects-valid bug.

(In reply to comment #0)
> I mean it also does it the other way around:

No, it doesn't. See below:

> "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()?)

Yes. And look what it does:

class Foo
{
    this(float f) {}
}

class Bar : Foo
{
}

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

Actually it shouldn't insert an implicit this() unless the base class has a
this(). Instead, it should complain that Bar needs a constructor, because Foo
has one.

-- 
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