1 // RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10 -verify %s 2 // rdar://9092208 3 4 __attribute__((unavailable("not available"))) 5 @interface MyClass { // expected-note 8 {{'MyClass' has been explicitly marked unavailable here}} 6 @public 7 void *_test; 8 MyClass *ivar; // no error. 9 } 10 11 - (id)self; 12 - new; 13 + (void)addObject:(id)anObject; 14 - (MyClass *)meth; // no error. 15 16 @end 17 18 @interface Gorf { 19 MyClass *ivar; // expected-error {{unavailable}} 20 } 21 - (MyClass *)meth; // expected-error {{unavailable}} 22 @end 23 24 @interface MyClass (Cat1) 25 - (MyClass *)meth; // no error. 26 @end 27 28 @interface MyClass (Cat2) // no error. 29 @end 30 31 @implementation MyClass (Cat2) // expected-error {{unavailable}} 32 @end 33 34 int main() { 35 [MyClass new]; // expected-error {{'MyClass' is unavailable: not available}} 36 [MyClass self]; // expected-error {{'MyClass' is unavailable: not available}} 37 [MyClass addObject:((void *)0)]; // expected-error {{'MyClass' is unavailable: not available}} 38 39 MyClass *foo = [MyClass new]; // expected-error 2 {{'MyClass' is unavailable: not available}} 40 41 return 0; 42 } 43 44 // rdar://16681279 45 @interface NSObject @end 46 47 __attribute__((visibility("default"))) __attribute__((availability(macosx,unavailable))) 48 @interface Foo : NSObject @end // expected-note 3 {{'Foo' has been explicitly marked unavailable here}} 49 @interface AppDelegate : NSObject 50 @end 51 52 @class Foo; 53 54 @implementation AppDelegate 55 - (void) applicationDidFinishLaunching 56 { 57 Foo *foo = 0; // expected-error {{'Foo' is unavailable}} 58 } 59 @end 60 61 @class Foo; 62 Foo *g_foo = 0; // expected-error {{'Foo' is unavailable}} 63 64 @class Foo; 65 @class Foo; 66 @class Foo; 67 Foo * f_func() { // expected-error {{'Foo' is unavailable}} 68 return 0; 69 } 70