Bug 1401 – Multiple inheritance of abstract template classes lead to segmentation fault.
Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-08-04T14:57:00Z
Last change time
2015-06-09T01:14:15Z
Keywords
ice-on-valid-code
Assigned to
bugzilla
Creator
frank-fischer
Comments
Comment #0 by frank-fischer — 2007-08-04T14:57:03Z
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.