[Issue 866] Abstract classes can't have constructors: fails to link, hard to find problem

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 31 12:53:14 PST 2007


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


bugzilla at digitalmars.com changed:

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




------- Comment #2 from bugzilla at digitalmars.com  2007-01-31 14:53 -------
For the first: The this(); declaration is not abstract, because it is not
virtual. It is possible for abstract classes to have constructors. If the
constructor is declared without a body, that means it is implemented elsewhere.
It is important to allow this so one can 'hide' implementations from the user
of the class. The error given is because there was no implementation found by
the linker. Not a bug.

For the second, the error has nothing to do with abstractness (the same error
will happen without the abstract keyword). The error is caused by the B
constructor has no call to A's constructor, so the compiler attempts to
implicitly call super(). But there is no A.this(), hence the error message.
Not a bug.

For both cases, the compiler is working as designed.


-- 



More information about the Digitalmars-d-bugs mailing list