The following segfaults the compiler
class Base {
abstract int str();
}
class Derived : Base {
override str() {
return "string";
}
}
Comment #1 by clugdbug — 2009-07-20T02:58:08Z
mtype.c, 3699 in DMD2.031. Crashing because t1->next is null.
Type *t1n = t1->next;
Type *t2n = t2->next;
+ if (!t1n || !t2n) goto Lnotcovariant;
if (t1n->equals(t2n))
goto Lcovariant;
---
It might be appealing to "return 3;" instead of "goto Lnotcovariant; (which returns 2)", but that's incorrect. The code below should be accepted:
class Base {
int str();
}
class Derived : Base {
auto str() {
return 3;
}
}
Comment #2 by clugdbug — 2009-08-12T08:51:45Z
*** Issue 3247 has been marked as a duplicate of this issue. ***
Comment #3 by clugdbug — 2009-09-04T00:26:13Z
*** Issue 3296 has been marked as a duplicate of this issue. ***