| 1 |
|
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Wunused-but-set-variable" } */ |
| 4 |
|
| 5 |
#import "../objc-obj-c++-shared/TestsuiteObject.m" |
| 6 |
|
| 7 |
@interface obj : TestsuiteObject |
| 8 |
{ |
| 9 |
int value; |
| 10 |
} |
| 11 |
- (int) value; |
| 12 |
- (void) setValue: (int)number; |
| 13 |
@end |
| 14 |
|
| 15 |
@implementation obj : TestsuiteObject |
| 16 |
|
| 17 |
- (int) value { return value; } |
| 18 |
- (void) setValue: (int)number { value = number; } |
| 19 |
|
| 20 |
@end |
| 21 |
|
| 22 |
int main (void) |
| 23 |
{ |
| 24 |
obj *a; /* { dg-bogus "set but not used" } */ |
| 25 |
obj *b; /* { dg-bogus "set but not used" } */ |
| 26 |
obj *c; /* { dg-warning "set but not used" } */ |
| 27 |
|
| 28 |
a = [obj new]; |
| 29 |
b = [obj new]; |
| 30 |
c = [obj new]; |
| 31 |
|
| 32 |
[b setValue: [a value]]; |
| 33 |
|
| 34 |
return [a value]; |
| 35 |
} |