minix/external/bsd/llvm/dist/clang/test/SemaObjC/no-ivar-access-control.m
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

71 lines
1,010 B
Objective-C

// RUN: %clang_cc1 -fsyntax-only -fdebugger-support -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fdebugger-support -fsyntax-only -verify -Wno-objc-root-class %s
// expected-no-diagnostics
// rdar://10997647
@interface I
{
@private
int ivar;
}
@end
@implementation I
- (int) meth {
return self->ivar;
}
int foo1(I* p) {
return p->ivar;
}
@end
int foo(I* p) {
return p->ivar;
}
@interface B
@end
@implementation B
- (int) meth : (I*) arg {
return arg->ivar;
}
@end
@interface I1 {
int protected_ivar;
}
@property int PROP_INMAIN;
@end
@interface I1() {
int private_ivar;
}
@property int PROP_INCLASSEXT;
@end
@implementation I1
@synthesize PROP_INMAIN, PROP_INCLASSEXT;
- (int) Meth {
PROP_INMAIN = 1;
PROP_INCLASSEXT = 2;
protected_ivar = 1; // OK
return private_ivar; // OK
}
@end
@interface DER : I1
@end
@implementation DER
- (int) Meth {
protected_ivar = 1; // OK
PROP_INMAIN = 1;
PROP_INCLASSEXT = 2;
return private_ivar;
}
@end