diff options
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 2 | ||||
-rw-r--r-- | test/SemaObjCXX/property-synthesis-error.mm | 32 |
2 files changed, 33 insertions, 1 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index fbb87b9bf4..f7555cfa6a 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -501,7 +501,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, ParmVarDecl *Param = (*P); Expr *rhs = new (Context) DeclRefExpr(Param,Param->getType(), SourceLocation()); - ExprResult Res = BuildBinOp(S, SourceLocation(), + ExprResult Res = BuildBinOp(S, lhs->getLocEnd(), BO_Assign, lhs, rhs); PIDecl->setSetterCXXAssignment(Res.takeAs<Expr>()); } diff --git a/test/SemaObjCXX/property-synthesis-error.mm b/test/SemaObjCXX/property-synthesis-error.mm new file mode 100644 index 0000000000..59e17b2a8d --- /dev/null +++ b/test/SemaObjCXX/property-synthesis-error.mm @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar: //8550657 + +@interface NSArray @end + +@interface NSMutableArray : NSArray @end + +@interface MyClass +{ + NSMutableArray * _array; +} + +@property (readonly) NSArray * array; + +@end + +@interface MyClass () + +@property (readwrite) NSMutableArray * array; + +@end + +@implementation MyClass + +@synthesize array=_array; // expected-error {{assigning to 'NSMutableArray *' from incompatible type 'NSArray *'}} + +@end + +int main(void) +{ + return 0; +} |