1 // RUN: %clang_cc1 -fsyntax-only -fblocks -triple x86_64-apple-darwin10 -verify %s
4 __attribute__((unavailable("not available")))
5 @interface MyClass { // expected-note 7 {{'MyClass' has been explicitly marked unavailable here}}
8 MyClass *ivar; // no error.
13 + (void)addObject:(id)anObject;
14 - (MyClass *)meth; // no error.
19 MyClass *ivar; // expected-error {{unavailable}}
21 - (MyClass *)meth; // expected-error {{unavailable}}
24 @interface MyClass (Cat1)
25 - (MyClass *)meth; // no error.
28 @interface MyClass (Cat2) // no error.
31 @implementation MyClass (Cat2) // no error.
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}}
39 MyClass *foo = [MyClass new]; // expected-error 2 {{'MyClass' is unavailable: not available}}
45 @interface NSObject @end
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
54 @implementation AppDelegate
55 - (void) applicationDidFinishLaunching
57 Foo *foo = 0; // expected-error {{'Foo' is unavailable}}
62 Foo *g_foo = 0; // expected-error {{'Foo' is unavailable}}
67 Foo * f_func() { // expected-error {{'Foo' is unavailable}}
71 #define UNAVAILABLE __attribute__((unavailable("not available")))
74 @interface Base // expected-note {{unavailable here}}
78 @protocol SomeProto // expected-note 4 {{unavailable here}}
81 @interface Sub : Base<SomeProto> // expected-error 2 {{unavailable}}
83 @interface IP<SomeProto> // expected-error {{unavailable}}
85 @protocol SubProt<SomeProto> // expected-error {{unavailable}}
87 @interface Sub(cat)<SomeProto> // expected-error {{unavailable}}
91 @interface UnavailSub : Base<SomeProto> // no error
94 @interface UnavailIP<SomeProto> // no error
97 @protocol UnavailProt<SomeProto> // no error
99 @interface UnavailSub(cat)<SomeProto> // no error
102 int unavail_global UNAVAILABLE;
104 UNAVAILABLE __attribute__((objc_root_class))
105 @interface TestAttrContext
109 @implementation TestAttrContext
111 unavail_global = 2; // no warn
113 unavail_global = 4; // no warn
118 typedef int unavailable_int UNAVAILABLE; // expected-note {{'unavailable_int' has been explicitly marked unavailable here}}
122 extern unavailable_int global_unavailable; // expected-error {{'unavailable_int' is unavailable: not available}}