diff options
-rw-r--r-- | lib/Sema/SemaObjCProperty.cpp | 6 | ||||
-rw-r--r-- | test/SemaObjCXX/property-synthesis-error.mm | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index f7555cfa6a..251af22415 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -460,7 +460,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, Ivar); if (ObjCMethodDecl *getterMethod = property->getGetterMethodDecl()) { getterMethod->createImplicitParams(Context, IDecl); - if (getLangOptions().CPlusPlus && Synthesize) { + if (getLangOptions().CPlusPlus && Synthesize && + Ivar->getType()->isRecordType()) { // For Objective-C++, need to synthesize the AST for the IVAR object to be // returned by the getter as it must conform to C++'s copy-return rules. // FIXME. Eventually we want to do this for Objective-C as well. @@ -488,7 +489,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, } if (ObjCMethodDecl *setterMethod = property->getSetterMethodDecl()) { setterMethod->createImplicitParams(Context, IDecl); - if (getLangOptions().CPlusPlus && Synthesize) { + if (getLangOptions().CPlusPlus && Synthesize + && Ivar->getType()->isRecordType()) { // FIXME. Eventually we want to do this for Objective-C as well. ImplicitParamDecl *SelfDecl = setterMethod->getSelfDecl(); DeclRefExpr *SelfExpr = diff --git a/test/SemaObjCXX/property-synthesis-error.mm b/test/SemaObjCXX/property-synthesis-error.mm index 59e17b2a8d..c7a279cfd7 100644 --- a/test/SemaObjCXX/property-synthesis-error.mm +++ b/test/SemaObjCXX/property-synthesis-error.mm @@ -22,7 +22,7 @@ @implementation MyClass -@synthesize array=_array; // expected-error {{assigning to 'NSMutableArray *' from incompatible type 'NSArray *'}} +@synthesize array=_array; @end |