From 25f071eedf5d20faf9e1614d5ff5dc39b6de5041 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Tue, 13 Nov 2012 23:16:33 +0000 Subject: Don't try to save the assigned value in a Objective-C property assignment if the type of the value is a non-trivial class type. Fixes PR14318. (There's a minor ObjC++ language change here: given that we can't save the value, the type of the assignment expression is void in such cases.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167884 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/SemaObjCXX/properties.mm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/SemaObjCXX') diff --git a/test/SemaObjCXX/properties.mm b/test/SemaObjCXX/properties.mm index 3c6b138586..0783eebc11 100644 --- a/test/SemaObjCXX/properties.mm +++ b/test/SemaObjCXX/properties.mm @@ -106,3 +106,26 @@ void test7(Test7 *ptr) { delete ptr.implicit_struct_property; delete ptr.explicit_struct_property; } + +// Make sure the returned value from property assignment is void, +// because there isn't any other viable way to handle it for +// non-trivial classes. +class NonTrivial1 { +public: + ~NonTrivial1(); +}; +class NonTrivial2 { +public: + NonTrivial2(); + NonTrivial2(const NonTrivial2&); +}; +@interface TestNonTrivial +@property(assign, nonatomic) NonTrivial1 p1; +@property(assign, nonatomic) NonTrivial2 p2; +@end +TestNonTrivial *TestNonTrivialObj; + +extern void* VoidType; +extern decltype(TestNonTrivialObj.p1 = NonTrivial1())* VoidType; +extern decltype(TestNonTrivialObj.p2 = NonTrivial2())* VoidType; + -- cgit v1.2.3-18-g5258