www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - cyclic classes/interfaces not rejected by dmd .121

reply zwang <nehzgnaw gmail.com> writes:
<code>
class A:B{}
class B:A{}
</code>

and

<code>
interface A:B{}
interface B:A{}
</code>

are silently accepted by dmd.
Apr 20 2005
parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

zwang schrieb am Wed, 20 Apr 2005 16:05:47 +0800:
<code>
 class A:B{}
 class B:A{}
</code>

 and

<code>
 interface A:B{}
 interface B:A{}
</code>

 are silently accepted by dmd.

segfaults under Linux Added to DStress as http://dstress.kuehne.cn/nocompile/class_13.d http://dstress.kuehne.cn/nocompile/class_14.d http://dstress.kuehne.cn/nocompile/interface_15.d http://dstress.kuehne.cn/nocompile/interface_16.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCZk3d3w+/yD4P9tIRAihPAJ91qQZ1mwplvzoTKPamHvkjYso/qQCgq/tf uCGuxxlI24mJZDIfWGgkTCs= =0glA -----END PGP SIGNATURE-----
Apr 20 2005
parent xs0 <xs0 xs0.com> writes:
Thomas Kuehne wrote:
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 zwang schrieb am Wed, 20 Apr 2005 16:05:47 +0800:
 
<code>
class A:B{}
class B:A{}
</code>

and

<code>
interface A:B{}
interface B:A{}
</code>

are silently accepted by dmd.

segfaults under Linux Added to DStress as http://dstress.kuehne.cn/nocompile/class_13.d http://dstress.kuehne.cn/nocompile/class_14.d http://dstress.kuehne.cn/nocompile/interface_15.d http://dstress.kuehne.cn/nocompile/interface_16.d Thomas

Hmm, if you think about it, it could actually be allowed (interfaces only, classes have an overload problem) - if A is a B and B is an A, obviously A equals B, and they could be merged, while both A and B become aliases to the merged interface. OTOH, I see no absolutely no use this could have, and it's far more likely that a bug in the code is involved.. xs0
Apr 21 2005