1 // RUN: %clang_cc1 -x objective-c -verify -fobjc-arc %s
8 - (void)declaredInSuper;
12 @interface NSObject (Category)
14 - (void)declaredInSuperCategory;
18 @interface Sub: NSObject
20 - (instancetype)init __attribute__((unavailable)); // expected-note 4 {{'init' has been explicitly marked unavailable here}}
22 - (void)notImplemented __attribute__((unavailable));
24 - (void)declaredInSuper __attribute__((unavailable));
25 - (void)declaredInSuperCategory __attribute__((unavailable));
32 return [[self alloc] init];
43 - (instancetype) init {
47 - (void)reportUseOfUnimplemented {
48 [self notImplemented];
51 - (void)allowSuperCallUsingSelf {
52 [self declaredInSuper];
53 [[Sub alloc] declaredInSuper];
54 [self declaredInSuperCategory];
55 [[Sub alloc] declaredInSuperCategory];
60 @interface SubClassContext: Sub
63 @implementation SubClassContext
65 - (void)subClassContext {
66 (void)[[Sub alloc] init]; // expected-error {{'init' is unavailable}}
67 (void)[Sub new]; // expected-error {{'new' is unavailable}}
72 void unrelatedContext(void) {
73 (void)[[Sub alloc] init]; // expected-error {{'init' is unavailable}}
74 (void)[Sub new]; // expected-error {{'new' is unavailable}}
80 -(void)meth __attribute__((unavailable));
83 @implementation X (Foo)
85 -(void)call_it { [self meth]; }