diff options
Diffstat (limited to 'test/SemaObjC/arc-decls.m')
-rw-r--r-- | test/SemaObjC/arc-decls.m | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/SemaObjC/arc-decls.m b/test/SemaObjC/arc-decls.m index 1084db8..8d5cca2 100644 --- a/test/SemaObjC/arc-decls.m +++ b/test/SemaObjC/arc-decls.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify %s +// RUN: %clang_cc1 -fsyntax-only -fblocks -fobjc-arc -verify -Wno-objc-root-class %s // rdar://8843524 @@ -21,6 +21,11 @@ union u { }; @end +// rdar://10260525 +struct r10260525 { + id (^block) (); // expected-error {{ARC forbids blocks in structs or unions}} +}; + struct S { id __attribute__((objc_ownership(none))) i; void * vp; @@ -81,3 +86,14 @@ void func() - (id)not_ret:(id) b __attribute((ns_returns_retained)); // expected-error {{overriding method has mismatched ns_returns_retained attributes}} - (id)both__returns_not_retained:(id) b __attribute((ns_returns_not_retained)); @end + +// Test that we give a good diagnostic here that mentions the missing +// ownership qualifier. We don't want this to get suppressed because +// of an invalid conversion. +void test7(void) { + id x; + id *px = &x; // expected-error {{pointer to non-const type 'id' with no explicit ownership}} + + I *y; + J **py = &y; // expected-error {{pointer to non-const type 'J *' with no explicit ownership}} expected-warning {{incompatible pointer types initializing}} +} |