const ObjCInterfaceType *RHS) {
// II is compatible with II<P> if the base is the same. Otherwise, no two
// qualified interface types are the same.
- if (LHS->getDecl() != RHS->getDecl()) return false;
+ if (!LHS->getDecl()->isSuperClassOf(RHS->getDecl()))
+ return false;
// If the base decls match and one is a qualified interface and one isn't,
// then they are compatible.
-// RUN: clang -fsyntax-only -verify %s
+// RUN: clang -fsyntax-only -pedantic -verify %s
#define nil (void *)0;
id <MyProtocol> obj_id_p = nil;
MyClass *obj_c_cat_p = nil;
MyOtherClass *obj_c_super_p = nil;
+ MyOtherClass<MyProtocol> *obj_c_super_p_q = nil;
obj_c_cat_p = obj_id_p; // expected-error {{incompatible type assigning 'id<MyProtocol>', expected 'MyClass *'}}
obj_c_super_p = obj_id_p; // expected-error {{incompatible type assigning 'id<MyProtocol>', expected 'MyOtherClass *'}}
if (obj_id_p == obj_c_cat_p) foo(); /* Ok */
if (obj_id_p == obj_c_super_p) foo(); /* Ok */
+ obj_c_cat_p = obj_c_super_p; // ok.
+ obj_c_cat_p = obj_c_super_p_q; // ok.
+
return 0;
}