[Issue 2061] wrong vtable call with multiple interface inheritance
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 9 09:43:55 PST 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2061
schveiguy at yahoo.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|critical |blocker
------- Comment #2 from schveiguy at yahoo.com 2008-12-09 11:43 -------
Bumped into this again, with a simpler inheritance tree.
extern(C) int printf(char*,...);
interface A
{
char a();
}
interface B
{
char b();
}
interface C : A, B
{
char c();
}
interface D
{
char d();
}
interface E : C, D
{
char e();
}
class Foo : E
{
char a() { return('a'); }
char b() { return('b'); }
char c() { return('c'); }
char d() { return('d'); }
char e() { return('e'); }
}
void main() {
auto foo = new Foo;
E e = foo; D d = foo; C c = foo; B b = foo; A a = foo;
printf("Foo: %c %c %c %c %c\n", foo.a, foo.b, foo.c, foo.d, foo.e);
printf("A: %c\n", a.a);
printf("B: %c\n", b.b);
printf("C: %c %c %c\n", c.a, c.b, c.c);
printf("D: %c\n", d.d);
printf("E: %c %c %c %c %c\n", e.a, e.b, e.c, e.d, e.e);
}
outputs:
Foo: a b c d e
A: a
B: b
C: a b c
D: d
E: a a c d e
Note the incorrect E line.
If I swap around E's base interfaces, so E now becomes:
interface E : D, C
{
char e();
}
Now the E line is still wrong:
Foo: a b c d e
A: a
B: b
C: a b c
D: d
E: d b c d e
Marking as a blocker. I don't know how to work around this.
--
More information about the Digitalmars-d-bugs
mailing list