summaryrefslogtreecommitdiff
path: root/test/SemaObjCXX/property-synthesis-error.mm
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaObjCXX/property-synthesis-error.mm')
-rw-r--r--test/SemaObjCXX/property-synthesis-error.mm23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/SemaObjCXX/property-synthesis-error.mm b/test/SemaObjCXX/property-synthesis-error.mm
index 4f64a3a3385e0..b6ab85ccab0dd 100644
--- a/test/SemaObjCXX/property-synthesis-error.mm
+++ b/test/SemaObjCXX/property-synthesis-error.mm
@@ -16,7 +16,7 @@
@interface MyClass ()
-@property (readwrite) NSMutableArray * array;
+@property (readwrite, retain) NSMutableArray * array;
@end
@@ -83,3 +83,24 @@ struct ConvertToIncomplete { operator IncompleteStruct&(); };
@implementation SynthIncompleteRef // expected-error {{cannot synthesize property 'x' with incomplete type 'IncompleteStruct'}}
@synthesize y; // expected-error {{cannot synthesize property 'y' with incomplete type 'IncompleteStruct'}}
@end
+
+
+// Check error handling for instantiation during property synthesis.
+template<typename T> class TemplateClass1 {
+ T *x; // expected-error {{'x' declared as a pointer to a reference of type 'int &'}}
+};
+template<typename T> class TemplateClass2 {
+ TemplateClass2& operator=(TemplateClass1<T>);
+ TemplateClass2& operator=(TemplateClass2) { T(); } // expected-error {{reference to type 'int' requires an initializer}} \
+ // expected-note 2 {{implicitly declared private here}} \
+ // expected-note {{'operator=' declared here}}
+};
+__attribute__((objc_root_class)) @interface InterfaceWithTemplateProperties
+@property TemplateClass2<int&> intprop;
+@property TemplateClass2<int&> &floatprop;
+@end
+@implementation InterfaceWithTemplateProperties // expected-error 2 {{'operator=' is a private member of 'TemplateClass2<int &>'}} \
+ // expected-error {{atomic property of reference type 'TemplateClass2<int &> &' cannot have non-trivial assignment operator}} \
+ // expected-note {{in instantiation of template class}} \
+ // expected-note {{in instantiation of member function}}
+@end