aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/attributes/method-unavailable-2.m
blob: 68ea46d254309cdecff081daa9357a74e6d3f5ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* Test __attribute__ ((unavailable)) */
/* { dg-do compile } */
/* { dg-options "" } */

#include <objc/objc.h>

@interface MyClass
{
  Class isa;
}
+ (int) unavailableClassMethod: (id)firstObject, ...    __attribute__((sentinel)) __attribute__((unavailable));
- (int) unavailableInstanceMethod: (id)firstobject, ... __attribute__((sentinel)) __attribute__((unavailable));
@end

/* Test that unavailability errors are produced even if the method is
   also marked with another attribute too (this is to test the
   processing of multiple attributes).  */
void foo (void)
{
  MyClass *object = nil;

  [MyClass unavailableClassMethod: object, nil];           /* { dg-error "is unavailable" } */
  [object unavailableInstanceMethod: object, nil];         /* { dg-error "is unavailable" } */
}