From 898f284d3777b6880b6a7051cccd0d11db7d5457 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Sat, 17 Sep 2011 18:48:50 +0000 Subject: [PATCH] objc: Don't crash with decl context for property impl. 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 | 2 +- test/SemaObjC/property.m | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 33c5e71b5e..a4f782227a 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -508,7 +508,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, IdentifierInfo *PropertyIvar, SourceLocation PropertyIvarLoc) { ObjCContainerDecl *ClassImpDecl = - cast_or_null(CurContext); + dyn_cast_or_null(CurContext); // Make sure we have a context for the property implementation declaration. if (!ClassImpDecl) { Diag(AtLoc, diag::error_missing_property_context); diff --git a/test/SemaObjC/property.m b/test/SemaObjC/property.m index 62291bb98c..8a4b1b63cc 100644 --- a/test/SemaObjC/property.m +++ b/test/SemaObjC/property.m @@ -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}} -- 2.40.0