I can confirm this! The example below triggers the above-mentioned bug. After some debugging it boiled down to an obscure error somwhere in the _d_isbaseof2() function in phobos/internal/cast.d.
module castbug;
interface I1 {
void f1();
}
interface I2 :I1 {
void f2();
}
class C1 : I1 {
void f1() {};
}
class C2 : I2 {
void f1() {};
void f2() {};
}
int main(char[][] args)
{
auto c1 = new C1();
auto c2 = new C2();
auto t = cast(C1)c2; /* SEGFAULT on x86_64 */
return 0;
}
I think this is a pretty serious bug!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Testrun Interfaces Feb 13th, 2008
Logged In: YES
user_id=1286246
Originator: NO
I can confirm this! The example below triggers the above-mentioned bug. After some debugging it boiled down to an obscure error somwhere in the _d_isbaseof2() function in phobos/internal/cast.d.
module castbug;
interface I1 {
void f1();
}
interface I2 :I1 {
void f2();
}
class C1 : I1 {
void f1() {};
}
class C2 : I2 {
void f1() {};
void f2() {};
}
int main(char[][] args)
{
auto c1 = new C1();
auto c2 = new C2();
auto t = cast(C1)c2; /* SEGFAULT on x86_64 */
return 0;
}
I think this is a pretty serious bug!
Logged In: YES
user_id=1378044
Originator: NO
Fixed in release 0.25 / svn 212.
This was a bug in GDC and not _d_isbaseof2. There is, however, another interface cast problem in the DMD front end and/or _d_isbaseof2: http://d.puremagic.com/issues/show_bug.cgi?id=2013