digitalmars.D.bugs - Certain upcasted class syntax cannot be an lvalue
- Jarrett Billingsley (27/27) Jan 09 2005 This works:
- Thomas Kuehne (12/12) Jan 10 2005 -----BEGIN PGP SIGNED MESSAGE-----
This works:
class A
{}
class B : A
{}
void main()
{
B b=new B;
A a=cast(A)b;
a=null;
}
Change main() to this, however:
void main()
{
B b=new B;
cast(A)b=null;
}
And it flags it as an error.
This also makes it impossible to do something like:
void fork(inout A a)
{}
void main()
{
B b=new B;
fork(b); // explicitly casting doesn't work either
}
It also has this problem if A is an interface.
Jan 09 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Added to DStress as http://dstress.kuehne.cn/run/cast_08.d http://dstress.kuehne.cn/run/cast_09.d http://dstress.kuehne.cn/run/cast_10.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFB40+M3w+/yD4P9tIRAtYkAKCoOs16eHd8usmDxA1wlaD0KuCV7gCghekM CjfWL0DqBpTk+o22F1CNx00= =LPLU -----END PGP SIGNATURE-----
Jan 10 2005








Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn>