diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-11 22:26:33 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2013-03-11 22:26:33 +0000 |
commit | 6fc9e7ad3576dcbee3028a42ef5dac931df8754c (patch) | |
tree | 17fe9fb281c37292271fa7753d0deb0fc59a2213 /test/SemaObjC | |
parent | 77b72231a0316509cc939b052be35fafce606567 (diff) |
Objective-C: When using super.prop, property should be
looked up the current class's super class.
// rdar://13349296
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176832 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaObjC')
-rw-r--r-- | test/SemaObjC/super-property-notation.m | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/test/SemaObjC/super-property-notation.m b/test/SemaObjC/super-property-notation.m index 0c17bb9392..a0364c9d9c 100644 --- a/test/SemaObjC/super-property-notation.m +++ b/test/SemaObjC/super-property-notation.m @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s -// expected-no-diagnostics +// RUN: %clang_cc1 -fsyntax-only -fobjc-default-synthesize-properties -verify %s @interface B +(int) classGetter; @@ -29,3 +28,25 @@ void f0() { int l2 = [A classGetter2]; } +// rdar://13349296 +__attribute__((objc_root_class)) @interface ClassBase +@property (nonatomic, retain) ClassBase * foo; +@end + +@implementation ClassBase +- (void) Meth:(ClassBase*)foo { + super.foo = foo; // expected-error {{'ClassBase' cannot use 'super' because it is a root class}} + [super setFoo:foo]; // expected-error {{'ClassBase' cannot use 'super' because it is a root class}} +} +@end + +@interface ClassDerived : ClassBase +@property (nonatomic, retain) ClassDerived * foo; +@end + +@implementation ClassDerived +- (void) Meth:(ClassBase*)foo { + super.foo = foo; // issues compile warning + [super setFoo:foo]; // works with no warning +} +@end |