From 506e717e4f20ab9f74feefa0e8ce19fdff9bec25 Mon Sep 17 00:00:00 2001 From: Steve Naroff Date: Tue, 30 Sep 2008 00:24:17 +0000 Subject: [PATCH] Fix Parser rejecting properly mismatched properties. llvm-svn: 56821 --- clang/lib/Sema/SemaDeclObjC.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 4e05a137a507..bb0923003b6b 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); -- GitLab