brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 2671dc1 Raw
29 lines · plain
1// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime-has-weak -fobjc-weak -fblocks -Wno-objc-root-class -std=c++98 -Wno-c++0x-extensions -verify %s2 3@interface AnObject4@property(weak) id value;5@end6 7__attribute__((objc_arc_weak_reference_unavailable))8@interface NOWEAK : AnObject // expected-note 2 {{class is declared here}}9@end10 11struct S {12  __weak id a; // expected-note {{because type 'S' has a member with __weak ownership}}13};14 15union U {16  __weak id a;17  S b;         // expected-error {{union member 'b' has a non-trivial copy constructor}}18};19 20void testCast(AnObject *o) {21  __weak id a = reinterpret_cast<__weak NOWEAK *>(o); // expected-error {{class is incompatible with __weak references}} \22                                                      // expected-error {{explicit ownership qualifier on cast result has no effect}} \23                                                      // expected-error {{assignment of a weak-unavailable object to a __weak object}}24 25  __weak id b = static_cast<__weak NOWEAK *>(o); // expected-error {{class is incompatible with __weak references}} \26                                                 // expected-error {{explicit ownership qualifier on cast result has no effect}} \27                                                 // expected-error {{assignment of a weak-unavailable object to a __weak object}}28}29