aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-08-12 18:17:53 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-08-12 18:17:53 +0000
commitacf2d137f362ede2b8f6a86b4f9dd9f6bcf00d7a (patch)
tree3c8e505e490cb3096504f828226bfe07538c86a7
parent46730b261c46765c51a9aa83c2571a2a8705482a (diff)
error on property of objc interface type instead of crashing
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78826 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaDeclObjC.cpp2
-rw-r--r--test/SemaObjC/invalid-objc-decls-1.m8
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 18536afcf7..75ac33673c 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1940,6 +1940,8 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
Diag(AtLoc, diag::warn_implements_nscopying)
<< FD.D.getIdentifier();
}
+ if (T->isObjCInterfaceType())
+ Diag(FD.D.getIdentifierLoc(), diag::err_statically_allocated_object);
DeclContext *DC = dyn_cast<DeclContext>(ClassDecl);
assert(DC && "ClassDecl is not a DeclContext");
diff --git a/test/SemaObjC/invalid-objc-decls-1.m b/test/SemaObjC/invalid-objc-decls-1.m
index e3a94f62d5..4a3732eff1 100644
--- a/test/SemaObjC/invalid-objc-decls-1.m
+++ b/test/SemaObjC/invalid-objc-decls-1.m
@@ -32,3 +32,11 @@ Super foo( // expected-error{{interface interface type 'Super' cannot be returne
Super p1; // expected-error{{interface type cannot be statically allocated}}
return p1;
}
+
+@interface NSMutableSet @end
+
+@interface DVTDummyAnnotationProvider
+ @property(readonly) NSMutableSet annotations; // expected-error{{interface type cannot be statically allocated}}
+
+@end
+