diff --git a/expr.cpp b/expr.cpp index c424f3c2..b04c8319 100644 --- a/expr.cpp +++ b/expr.cpp @@ -2678,12 +2678,12 @@ FunctionCallExpr::TypeCheck() { const Type *fptrType = func->GetType(); if (fptrType == NULL) return NULL; - - Assert(dynamic_cast(fptrType) != NULL); - const FunctionType *funcType = - dynamic_cast(fptrType->GetBaseType()); - if (funcType == NULL) { - Error(pos, "Must provide function name or function pointer for " + + // Make sure we do in fact have a function to call + const FunctionType *funcType; + if (dynamic_cast(fptrType) == NULL || + (funcType = dynamic_cast(fptrType->GetBaseType())) == NULL) { + Error(func->pos, "Must provide function name or function pointer for " "function call expression."); return NULL; }