|
Archives
D Programming
DD.gnu digitalmars.D digitalmars.D.bugs digitalmars.D.dtl digitalmars.D.ide digitalmars.D.dwt digitalmars.D.announce digitalmars.D.learn digitalmars.D.debugger C/C++ Programming
c++c++.announce c++.atl c++.beta c++.chat c++.command-line c++.dos c++.dos.16-bits c++.dos.32-bits c++.idde c++.mfc c++.rtl c++.stl c++.stl.hp c++.stl.port c++.stl.sgi c++.stlsoft c++.windows c++.windows.16-bits c++.windows.32-bits c++.wxwindows digitalmars.empire digitalmars.DMDScript electronics |
digitalmars.D.bugs - [Issue 2061] New: wrong vtable call with multiple interface inheritance
http://d.puremagic.com/issues/show_bug.cgi?id=2061 Summary: wrong vtable call with multiple interface inheritance Product: D Version: 1.029 Platform: PC OS/Version: Linux Status: NEW Severity: critical Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: schveiguy yahoo.com This might be related to http://d.puremagic.com/issues/show_bug.cgi?id=1978 I added Frank and Lars to the CC in case they are interested. Basically, I think it has to do with a class implementing two interfaces that inherit from the same base interface. This might be a minimal example: extern(C) int printf(char*,...); interface A(V) { int foo(); } interface B(K, V) : A!(V) { alias A!(V).foo foo; // needed or else A isn't examined to resolve foo() int foo(int x); } interface C(K, V) : B!(K, V) { } interface D(K, V) : A!(V), C!(K, V) { alias C!(K, V).foo foo; // needed or else A is used to resolve foo int bar(); } class E(K, V) : C!(K, V) { int foo() {printf("foo\n"); return 0;} int foo(int x) {printf("foo(int)\n"); return 0;} int bar() {printf("bar\n"); return 0;} } void main() { C!(uint, uint) c = new D!(uint, uint); c.foo(); c.foo(0); c.bar(); } outputs: foo bar bar The following change to interface D seems to resolve the issue: interface D(K, V) : C!(K, V), A!(V) { int bar(); } However, there might be cases where this kind of solution is not possible. -- Apr 30 2008
|