Fix unsafe static cast...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46980 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp
index aba5b42..b14e20b 100644
--- a/Sema/SemaDecl.cpp
+++ b/Sema/SemaDecl.cpp
@@ -1052,8 +1052,8 @@
       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;