]> granicus.if.org Git - clang/commitdiff
objc: Don't crash with decl context for property impl.
authorFariborz Jahanian <fjahanian@apple.com>
Sat, 17 Sep 2011 18:48:50 +0000 (18:48 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Sat, 17 Sep 2011 18:48:50 +0000 (18:48 +0000)
is missing. // rdar//10127639

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139988 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaObjCProperty.cpp
test/SemaObjC/property.m

index 33c5e71b5eb47975488cd694f2fc4bc1b125df56..a4f782227afeb4ec365499ecb333dc1c1d9fb6cf 100644 (file)
@@ -508,7 +508,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
                                   IdentifierInfo *PropertyIvar,
                                   SourceLocation PropertyIvarLoc) {
   ObjCContainerDecl *ClassImpDecl =
-    cast_or_null<ObjCContainerDecl>(CurContext);
+    dyn_cast_or_null<ObjCContainerDecl>(CurContext);
   // Make sure we have a context for the property implementation declaration.
   if (!ClassImpDecl) {
     Diag(AtLoc, diag::error_missing_property_context);
index 62291bb98cf21fac7f6a69d6cd8fbc8630e5d7f4..8a4b1b63cc10112d795cb32073025da73dd8fcd3 100644 (file)
@@ -63,3 +63,5 @@ typedef id BYObjectIdentifier;
 @property int treeController;  // expected-error {{property has a previous declaration}}
 @end
 
+// rdar://10127639
+@synthesize window; // expected-error {{missing context for property implementation declaration}}