]> granicus.if.org Git - clang/commitdiff
Fix unsafe static cast...
authorSteve Naroff <snaroff@apple.com>
Tue, 12 Feb 2008 01:09:36 +0000 (01:09 +0000)
committerSteve Naroff <snaroff@apple.com>
Tue, 12 Feb 2008 01:09:36 +0000 (01:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46980 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaDecl.cpp

index aba5b421928a50e4876bed2e14999fc1f92991db..b14e20b2c373a8b8d7533375493f209aa2a863db 100644 (file)
@@ -1052,8 +1052,8 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
       Diag(FD->getLocation(), diag::err_previous_definition);
     }
   }
-  FunctionDecl *FD =
-    static_cast<FunctionDecl*>(ActOnDeclarator(GlobalScope, D, 0));
+  Decl *decl = static_cast<Decl*>(ActOnDeclarator(GlobalScope, D, 0));
+  FunctionDecl *FD = dyn_cast<FunctionDecl>(decl);
   assert(FD != 0 && "ActOnDeclarator() didn't return a FunctionDecl");
   CurFunctionDecl = FD;