Cast not called when casting between programs
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=2628
Reported by Mikael Brandström mikael@brandstrom.org
As seen in this example code and printout from function calls, it seems like cast is not called when it ought to be called -- ie. when object(Foo) is casted to object(Bar).
class Foo {
mixed cast(string to){
write(to+"\n");
}
int i;
void create(int _ ){ i=_; }
}
class Bar {
mixed cast(string to){
write(to+"\n");
}
}
void test1(){ Bar a=Bar(); Foo b=(object(Foo))a; }
void test2(){ Foo a=Foo(1); int b=(int)a; }
Printout from function calls.
> test1();
Result: 0
> test2();
int
Result: 0