[Issue 1401] New: Multiple inheritance of abstract template classes lead to segmentation fault.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 4 12:57:04 PDT 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1401

           Summary: Multiple inheritance of abstract template classes lead
                    to segmentation fault.
           Product: D
           Version: 2.003
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: frank-fischer at shadow-soft.de


The following code using an abstract template class and multiple inheritance
produces a segmentation fault.

---
module mytest;

import std.stdio;

interface A(T) {
    C!(T) func();
    size_t f();
}

abstract class B(T): A!(T) {
}

interface C(T): A!(T) {
}

class D: B!(int), C!(int) {
    size_t f() { return 42; }
    C!(int) func() { return this; }
}

void main() {
    A!(int) x = new D();
    writefln("%d", x.f());
}
---

When I compile this snippet with dmd 2.003 on my linux-box, I get a
segmentation fault on the call "x.f()" in the last line. Furthermore, if I
use an interface instead of an abstract class for B, everything is fine.
Even if I just change the order of definition of 'func' and 'f' in A, i.e.

interface A(T) {
    size_t f();
    C!(T) func();
}

everything works.


-- 



More information about the Digitalmars-d-bugs mailing list