RHS of property expression assignment requires
copy initialization before passing it to
a setter. Fixes radar 8427922.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113885 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGenObjCXX/property-dot-copy.mm b/test/CodeGenObjCXX/property-dot-copy.mm
new file mode 100644
index 0000000..35321ad
--- /dev/null
+++ b/test/CodeGenObjCXX/property-dot-copy.mm
@@ -0,0 +1,34 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s
+// rdar://8427922
+
+struct Vector3D
+{
+ float x, y, z;
+ Vector3D();
+ Vector3D(const Vector3D &inVector);
+ Vector3D(float initX, float initY, float initZ);
+ Vector3D &operator=(const Vector3D & rhs);
+};
+
+@interface Object3D
+{
+ Vector3D position;
+ Vector3D length;
+}
+@property (assign) Vector3D position;
+- (Vector3D) length;
+- (void) setLength: (Vector3D)arg;
+@end
+
+int main ()
+{
+ Object3D *myObject;
+ Vector3D V3D(1.0f, 1.0f, 1.0f);
+// CHECK: call void @_ZN8Vector3DC1ERKS_
+ myObject.position = V3D;
+
+// CHECK: call void @_ZN8Vector3DC1ERKS_
+ myObject.length = V3D;
+
+ return 0;
+}