switch() on types not working even when `==() succeeds
Imported from http://bugzilla.roxen.com/bugzilla/show_bug.cgi?id=4577
Reported by Jonas Wallden jonasw@roxen.com
class Abstract { };
class Fruit { inherit Abstract; };
class Color { inherit Abstract; };
void main()
{
Fruit banana = Fruit();
Color yellow = Color();
werror("Is banana a fruit? %O\n", object_program(banana) == Fruit);
werror("Is yellow a fruit? %O\n", object_program(yellow) == Fruit);
switch (object_program(banana)) {
case Fruit:
werror("Yes, banana is still a fruit.\n");
break;
default:
werror("Banana is a... uh, don't remember.\n");
break;
}
}
Interestingly enough the program works if the inherit of Abstract is removed from the Fruit class.