diff options
Diffstat (limited to 'test/SemaObjC/arc-repeated-weak.mm')
-rw-r--r-- | test/SemaObjC/arc-repeated-weak.mm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/SemaObjC/arc-repeated-weak.mm b/test/SemaObjC/arc-repeated-weak.mm index 11161a0bf7fc..37b2123ec1c4 100644 --- a/test/SemaObjC/arc-repeated-weak.mm +++ b/test/SemaObjC/arc-repeated-weak.mm @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-arc -fblocks -Wno-objc-root-class -std=c++11 -Warc-repeated-use-of-weak -verify %s +// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-weak -fblocks -Wno-objc-root-class -std=c++11 -Warc-repeated-use-of-weak -verify %s @interface Test { @public @@ -445,8 +446,8 @@ void doubleLevelAccessIvar(Test *a, Test *b) { @class NSString; @interface NSBundle +(NSBundle *)foo; -@property (class) NSBundle *foo2; -@property NSString *prop; +@property (class, strong) NSBundle *foo2; +@property (strong) NSString *prop; @property(weak) NSString *weakProp; @end @@ -462,3 +463,19 @@ void foo() { use(NSBundle.foo2.weakProp); // expected-warning{{weak property 'weakProp' may be accessed multiple times}} use(NSBundle2.foo2.weakProp); // expected-note{{also accessed here}} } + +// This used to crash in the constructor of WeakObjectProfileTy when a +// DeclRefExpr was passed that didn't reference a VarDecl. + +typedef INTF * INTFPtrTy; + +enum E { + e1 +}; + +void foo1() { + INTFPtrTy tmp = (INTFPtrTy)e1; +#if __has_feature(objc_arc) +// expected-error@-2{{cast of 'E' to 'INTFPtrTy' (aka 'INTF *') is disallowed with ARC}} +#endif +} |