aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AST/Decl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/AST/Decl.cpp b/AST/Decl.cpp
index b7f85e9a53..16233b1d82 100644
--- a/AST/Decl.cpp
+++ b/AST/Decl.cpp
@@ -242,7 +242,8 @@ FunctionDecl::~FunctionDecl() {
}
unsigned FunctionDecl::getNumParams() const {
- return cast<FunctionTypeProto>(getType().getTypePtr())->getNumArgs();
+ if (isa<FunctionTypeNoProto>(getType())) return 0;
+ return cast<FunctionTypeProto>(getType())->getNumArgs();
}
void FunctionDecl::setParams(ParmVarDecl **NewParamInfo, unsigned NumParams) {