]> granicus.if.org Git - clang/commitdiff
[objc] Add a test to make sure that a class can add a secondary initializer via a...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 14 Dec 2013 02:16:41 +0000 (02:16 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sat, 14 Dec 2013 02:16:41 +0000 (02:16 +0000)
and still inherit the designated initializers of its super class.

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

test/SemaObjC/attr-designated-init.m

index 5a35a36e84511470e1c44bb7f597490f8f37d516..0432a1859bb77094c0e3fa6ed3b9f2ac33376a94 100644 (file)
@@ -34,7 +34,7 @@ __attribute__((objc_root_class))
 
 __attribute__((objc_root_class))
 @interface B1
--(id)initB1 NS_DESIGNATED_INITIALIZER; // expected-note 5 {{method marked as designated initializer of the class here}}
+-(id)initB1 NS_DESIGNATED_INITIALIZER; // expected-note 6 {{method marked as designated initializer of the class here}}
 -(id)initB2;
 -(id)initB3 NS_DESIGNATED_INITIALIZER; // expected-note 3 {{method marked as designated initializer of the class here}}
 @end
@@ -219,3 +219,22 @@ __attribute__((objc_root_class))
   return [super init];
 }
 @end
+
+@interface S9 : B1
+-(id)initB1;
+-(id)initB3;
+@end
+
+@interface S9(secondInit)
+-(id)initNewOne;
+@end
+
+@interface SS9 : S9
+-(id)initB1;
+@end
+
+@implementation SS9
+-(id)initB1 { // expected-warning {{designated initializer missing a 'super' call to a designated initializer of the super class}}
+  return 0;
+}
+@end