aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/objc.dg/set-not-used-1.m
blob: 21ce962e8166f231d0555b63c1462cf425a18aaa (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

/* { dg-do compile } */
/* { dg-options "-Wunused-but-set-variable" } */

#import "../objc-obj-c++-shared/TestsuiteObject.m"

@interface obj : TestsuiteObject
{
  int value;
}
- (int) value;
- (void) setValue: (int)number;
@end

@implementation obj : TestsuiteObject

- (int) value { return value; }
- (void) setValue: (int)number { value = number; }

@end

int main (void)
{
  obj *a;		/* { dg-bogus "set but not used" } */
  obj *b;		/* { dg-bogus "set but not used" } */
  obj *c;		/* { dg-warning "set but not used" } */

  a = [obj new];
  b = [obj new];
  c = [obj new];

  [b setValue: [a value]];

  return [a value];
}