diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-11-13 23:16:33 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-11-13 23:16:33 +0000 |
commit | 25f071eedf5d20faf9e1614d5ff5dc39b6de5041 (patch) | |
tree | 9f973a73dc0d940981bf71444d63f41bfcac0e4d /test/SemaObjCXX | |
parent | 0a26d7680d064653cb42e89e70c62402283003fd (diff) |
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
Diffstat (limited to 'test/SemaObjCXX')
-rw-r--r-- | test/SemaObjCXX/properties.mm | 23 |
1 files changed, 23 insertions, 0 deletions
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; + |