Debian Codegraph @

gcc/testsuite/obj-c++.dg/attributes/method-unavailable-2.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) unavailableClassMethod: (id)firstObject, ... __attribute__((sentinel)) __attribute__((unavailable));
12 - (int) unavailableInstanceMethod: (id)firstobject, ... __attribute__((sentinel)) __attribute__((unavailable));
13 @end
14
15 /* Test that unavailability errors are produced even if the method is
16 also marked with another attribute too (this is to test the
17 processing of multiple attributes). */
18 void foo (void)
19 {
20 MyClass *object = nil;
21
22 [MyClass unavailableClassMethod: object, nil]; /* { dg-error "is unavailable" } */
23 [object unavailableInstanceMethod: object, nil]; /* { dg-error "is unavailable" } */
24 }