summaryrefslogtreecommitdiff
path: root/gcc/testsuite/obj-c++.dg/property/property-1.mm
blob: c9b9c46423a252f5ab4484d84a838f20a88e1f86 (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
/* 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" } { "" } } */
/* { dg-additional-sources "../../objc-obj-c++-shared/Object1.mm" } */

#import "../../objc-obj-c++-shared/Object1.h"

@interface Bar : Object
{
  int iVar;
}
@property int FooBar;
@end

@implementation Bar
@property (ivar = iVar, setter = MySetter:) int FooBar;

- (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;
}