summaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/property/at-property-deprecated-1.m
blob: e520477717659de06825076e9aaa86ebeb863997 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010.  */
/* { dg-do compile } */

/* Test that properties can be deprecated.  */

#include <stdlib.h>
#include <objc/objc.h>
#include <objc/runtime.h>

@interface MyRootClass
{
  Class isa;
  int a;
}
@property int a __attribute__((deprecated));
+ (id) initialize;
+ (id) alloc;
- (id) init;
@end

@implementation MyRootClass
+ (id) initialize { return self; }
+ (id) alloc { return class_createInstance (self, 0); }
- (id) init { return self; }
@synthesize a;
@end

int main (void)
{
  MyRootClass *object = [[MyRootClass alloc] init];

  object.a = 40;      /* { dg-warning "is deprecated" } */
  if (object.a != 40) /* { dg-warning "is deprecated" } */
    abort ();

  return 0;
}