]> granicus.if.org Git - clang/commitdiff
Only assignment operator triggers property setter call.
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 17 Sep 2010 20:45:45 +0000 (20:45 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 17 Sep 2010 20:45:45 +0000 (20:45 +0000)
Fixes radar 8437253.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114207 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/CodeGenObjCXX/property-dot-copy.mm

index 20315084703932f2894a1e0a4d93db29eca0edeb..83319a8087877d4f987bbf7e42f4a3bd60711c50 100644 (file)
@@ -6720,7 +6720,7 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc,
   if (getLangOptions().CPlusPlus &&
       ((!isa<ObjCImplicitSetterGetterRefExpr>(lhs) && 
         !isa<ObjCPropertyRefExpr>(lhs))
-        || rhs->isTypeDependent()) &&
+        || rhs->isTypeDependent() || Opc != BO_Assign) &&
       (lhs->getType()->isOverloadableType() ||
        rhs->getType()->isOverloadableType())) {
     // Find all of the overloaded operators visible from this
index 35321ad5eb91314902a8a5b1eadcac4ca529c254..9b23c58ca17b41ca7eac4ba888f95a9e43314dbf 100644 (file)
@@ -32,3 +32,37 @@ int main ()
 
         return 0;
 }
+
+// rdar: // 8437253
+extern "C" void exit(...);
+
+struct CGPoint {
+  float x;
+  float y;
+};
+typedef struct CGPoint CGPoint;
+
+extern "C" const CGPoint CGPointZero;
+
+bool operator==(const CGPoint& a, const CGPoint& b);
+
+@interface TIconViewSettings
+@property (assign, nonatomic) CGPoint gridOffset;
+@end
+
+@implementation TIconViewSettings
+- (CGPoint) gridOffset
+{
+ return CGPointZero;
+}
+
+- (void) foo
+{
+        if ((self.gridOffset) == CGPointZero)
+                exit(1);
+
+ if (self.gridOffset == CGPointZero)
+  exit(1);
+}
+@end
+