414 – interfaces shouldn't be able to inheit from classes

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 414 - interfaces shouldn't be able to inheit from classes
Summary: interfaces shouldn't be able to inheit from classes
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Windows
: P2 normal
Assignee: Walter Bright
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
Reported: 2006年10月09日 09:42 UTC by david
Modified: 2014年02月15日 13:21 UTC (History)
1 user (show)

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description david 2006年10月09日 09:42:10 UTC
http://paste.dprogramming.com/dpi6v8ch.php
interfaces shouldn't be able to inheit from classes
import std.c.stdio;
import std.stdio;
 interface a{
 int c();
 }
void main()
{
 class b:a{
 int c(){writefln("b.c");return 1;}
 }
 class c:b{
 int c(){writefln("c.c");return 1;}
 }
 class f:b{
 int k(){writefln("f.k");return 1;}
 }
 interface u:c,f,a{
 int c();
 int k();
 }
 class d:u
 {
 int c(){writefln("d.c");return 2;}
 int k(){writefln("d.k");return 2;}
 }
 d a= new d;
 c v= cast(c)a;
 f newf=cast(f)a;
 a.k(); //prints d.k
 newf.k(); //access violation
 v.c(); //access violation
}
Comment 1 Walter Bright 2006年10月18日 13:26:24 UTC
Fixed DMD 0.170
Comment 2 Thomas Kühne 2006年10月21日 08:40:35 UTC
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
d-bugmail@puremagic.com schrieb am 2006年10月09日:
> http://d.puremagic.com/issues/show_bug.cgi?id=414 
> http://paste.dprogramming.com/dpi6v8ch.php
> interfaces shouldn't be able to inheit from classes
<snip>
Added to DStress as
http://dstress.kuehne.cn/nocompile/i/interface_25_A.d
http://dstress.kuehne.cn/nocompile/i/interface_25_B.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFFOixCLK5blCcjpWoRAqidAJ43AN588E9oakaelzyHC7oedpEs/gCfZ+aC
9ia/LSwK8hO7X2+GMymVKGA=
=TleA
-----END PGP SIGNATURE-----


AltStyle によって変換されたページ (->オリジナル) /