Debian Codegraph @

gcc/testsuite/obj-c++.dg/attributes/method-unavailable-1.mm

raw
1 /* Test __attribute__ ((unavailable)) */
2 /* { dg-do compile } */
3 /* { dg-options "" } */
4
5 #include <objc/objc.h>
6
7 @interface MyClass
8 {
9 Class isa;
10 }
11 + (int) method;
12 - (int) method;
13 + (int) unavailableClassMethod __attribute__((unavailable));
14 - (int) unavailableInstanceMethod __attribute__((unavailable));
15 @end
16
17 /* Test that deprecation warnings are produced, but not if the
18 receiver is of type 'id'. */
19 void foo (void)
20 {
21 Class c;
22 id object;
23 MyClass *another_object;
24
25 [c method];
26 [object method];
27 [c unavailableClassMethod];
28 [object unavailableInstanceMethod];
29
30 [object method];
31 [another_object method];
32 [MyClass unavailableClassMethod]; /* { dg-error "is unavailable" } */
33 [another_object unavailableInstanceMethod]; /* { dg-error "is unavailable" } */
34 }