[qfcc] Catch assignment of void* to class pointers

id and other class pointers imply that the object can receive messages,
but void * has no such implication, so treat it as a mismatch.
This commit is contained in:
Bill Currie 2020-03-05 14:14:20 +09:00
parent 65a5e4f2a4
commit ccaa4ad3d2

View file

@ -445,8 +445,14 @@ obj_types_assignable (const type_t *dst, const type_t *src)
int i;
//puts ("%$$\"$#%");
if (!obj_is_classptr (dst) || !obj_is_classptr (src))
if (!obj_is_classptr (src)) {
// if dst is a class pointer, then the types are not compatible,
// otherwise unknown
return obj_is_classptr (dst) - 1;
}
if (!obj_is_classptr (dst)) {
return -1;
}
dst_is_proto = obj_is_id (dst) && (dst_protos = obj_get_protos (dst));
src_is_proto = obj_is_id (src) && (src_protos = obj_get_protos (src));