digitalmars.D.bugs - [Issue 11796] New: interface multiple inheritance not call methods
- d-bugmail puremagic.com (23/23) Dec 21 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11796
- d-bugmail puremagic.com (28/28) Dec 22 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11796
- d-bugmail puremagic.com (25/26) Dec 22 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11796
- d-bugmail puremagic.com (14/14) Dec 22 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11796
https://d.puremagic.com/issues/show_bug.cgi?id=11796 Summary: interface multiple inheritance not call methods Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: code.viator gmail.com Created an attachment (id=1302) core.exception.AssertError bug2.d(38): funcA not called In situation with multiple inheritance in realization, like in attachment, there is a problem: functions (funcA) of the first interface (IFaceA) isn't callable, of which inherited the intermediate interface (IFaceA1) compiler: DMD64 D Compiler v2.064-devel-37e15ab OS: Linux 3.11.6-200.fc19.x86_64 -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 21 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11796 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andrej.mitrovich gmail.com 01:12:16 PST --- Reduced: ----- interface I1 { void func1(); } interface I2 { void func2(); } interface I3 : I1 { } interface I4 : I2, I3 { } class Test : I4 { void func1() { check = true; } void func2() { } bool check; } void main() { I4 sub = new Test; sub.func1(); assert((cast(Test)sub).check); // fails } ----- -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 22 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11796 01:13:38 PST ---Reduced:What's worrying is that func2() ends up being called: ----- interface I1 { void func1(); } interface I2 { void func2(); } interface I3 : I1 { } interface I4 : I2, I3 { } import std.stdio; class Test : I4 { void func1() { check = true; } void func2() { assert(0); } bool check; } void main() { I4 sub = new Test; sub.func1(); // triggers assertion (func2 called) } ----- -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 22 2013
https://d.puremagic.com/issues/show_bug.cgi?id=11796 Maxim Fomin <maxim maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim maxim-fomin.ru --- Note, if order of interfaces in derivative list is changed, program runs fine. interface I4 : I2, I3 { } => interface I4 : I3, I2 { } Perhaps compiler puts func2() before func1() in vitrual table, after reading Test class definition assumes that func1() is placed before func2(), so the second function is called. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 22 2013