aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/obj-c++.dg/property/property-1.mm
blob: 57a171337c6209538924b496525867466cf50577 (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
/* This program tests use of property provided setter/getter functions. */
/* { dg-do run } */
/* { dg-xfail-run-if "Needs OBJC2 ABI" { *-*-darwin* && { lp64 && { ! objc2 } } } { "-fnext-runtime" } { "" } } */

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

@interface Bar : TestsuiteObject
{
  int iVar;
}
@property (setter=MySetter:) int FooBar;
@end

@implementation Bar
@synthesize FooBar=iVar;

- (void) MySetter : (int) value { iVar = value; }

@end

int main(int argc, char *argv[]) {
    Bar *f = [Bar new];
    f.FooBar = 1;

    f.FooBar += 3;

    f.FooBar -= 4;
    return f.FooBar;
}