Issue error instead of crashing given attempted function call through non-function.
Fixes issue #163.
This commit is contained in:
10
expr.cpp
10
expr.cpp
@@ -2679,11 +2679,11 @@ FunctionCallExpr::TypeCheck() {
|
||||
if (fptrType == NULL)
|
||||
return NULL;
|
||||
|
||||
Assert(dynamic_cast<const PointerType *>(fptrType) != NULL);
|
||||
const FunctionType *funcType =
|
||||
dynamic_cast<const FunctionType *>(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<const PointerType *>(fptrType) == NULL ||
|
||||
(funcType = dynamic_cast<const FunctionType *>(fptrType->GetBaseType())) == NULL) {
|
||||
Error(func->pos, "Must provide function name or function pointer for "
|
||||
"function call expression.");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user