[RISCV] Rename a lambda to have plural nouns to reflect that it contains a loop. NFC
[llvm-project.git] / clang / test / SemaObjCXX / objc-weak.mm
blob2671dc104c660e1847ea6a61cf72a05b2f7171a6
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 %s
3 @interface AnObject
4 @property(weak) id value;
5 @end
7 __attribute__((objc_arc_weak_reference_unavailable))
8 @interface NOWEAK : AnObject // expected-note 2 {{class is declared here}}
9 @end
11 struct S {
12   __weak id a; // expected-note {{because type 'S' has a member with __weak ownership}}
15 union U {
16   __weak id a;
17   S b;         // expected-error {{union member 'b' has a non-trivial copy constructor}}
20 void 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}}
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}}