www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - instantiation of class with abstract this() not caught by compiler

reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
I was looking into making classes abstract when I came across this.

class Base
{
    abstract this();
}

void main()
{
    Base b=new Base;
}

This compiles, but thankfully fails to link, as it cannot find the
constructor function for Base.

The compiler should catch this, as it throws an error if you try to
instantiate a class with other undefined abstract methods.

Unless of course, there is something that prohibits this from happening, in
which case I'll eat my words ;)
Dec 29 2004
next sibling parent "Thomas Kuehne" <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Added to DStress as
http://dstress.kuehne.cn/nocompile/abstract_05.d

Thomas

-----BEGIN PGP SIGNATURE-----

iD8DBQFB09gp3w+/yD4P9tIRApwHAJ9q9gCaSl1k94HE/SOuQLh48LaG6gCgjqeg
u78Hbm+OufJuCjKG3HNp3r0=
=QTNa
-----END PGP SIGNATURE-----
Dec 30 2004
prev sibling parent "Walter" <newshound digitalmars.com> writes:
It's also fixed <g>.
Mar 09 2005