diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 4e05a137a507dcbdae055c4a966ada19619a6430..bb0923003b6bace8fac0ada408595ff943b6944c 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -1254,14 +1254,14 @@ Sema::DeclTy *Sema::ActOnPropertyImplDecl(SourceLocation AtLoc, PropertyId->getName()); return 0; } - // Check that type of property and its ivar match. - if (Context.getCanonicalType(Ivar->getType()) != - Context.getCanonicalType(property->getType())) { + // Check that type of property and its ivar are type compatible. + // A property is allowed to be a sub-class of the instance variable type. + if (CheckAssignmentConstraints(property->getType(), + Ivar->getType()) != Compatible) { Diag(PropertyLoc, diag::error_property_ivar_type, property->getName(), Ivar->getName()); return 0; } - } else if (PropertyIvar) { // @dynamic Diag(PropertyLoc, diag::error_dynamic_property_ivar_decl);