freebsd-dev/test/SemaObjC/nsobject-attribute.m

43 lines
1008 B
Mathematica
Raw Normal View History

2010-01-01 10:34:51 +00:00
// RUN: %clang_cc1 -fsyntax-only -verify %s
2009-06-02 17:58:47 +00:00
typedef struct CGColor * __attribute__ ((NSObject)) CGColorRef;
static int count;
static CGColorRef tmp = 0;
typedef struct S1 __attribute__ ((NSObject)) CGColorRef1; // expected-error {{__attribute ((NSObject)) is for pointer types only}}
typedef void * __attribute__ ((NSObject)) CGColorRef2; // expected-error {{__attribute ((NSObject)) is for pointer types only}}
2010-04-02 08:55:10 +00:00
2009-06-02 17:58:47 +00:00
@interface HandTested {
@public
CGColorRef x;
}
2010-04-02 08:55:10 +00:00
2009-06-02 17:58:47 +00:00
@property(copy) CGColorRef x;
2010-04-02 08:55:10 +00:00
// rdar: // 7809460
typedef struct CGColor *CGColorRefNoNSObject;
@property (nonatomic, retain) __attribute__((NSObject)) CGColorRefNoNSObject color;
2009-06-02 17:58:47 +00:00
@end
void setProperty(id self, id value) {
((HandTested *)self)->x = value;
}
id getProperty(id self) {
return (id)((HandTested *)self)->x;
}
@implementation HandTested
@synthesize x=x;
2010-04-02 08:55:10 +00:00
@dynamic color;
2009-06-02 17:58:47 +00:00
@end
2009-10-14 18:03:49 +00:00
int main(int argc, char *argv[]) {
2009-06-02 17:58:47 +00:00
HandTested *to;
to.x = tmp; // setter
if (tmp != to.x)
to.x = tmp;
return 0;
}