Issue error instead of crashing given attempted function call through non-function.
Fixes issue #163.
This commit is contained in:
12
expr.cpp
12
expr.cpp
@@ -2678,12 +2678,12 @@ FunctionCallExpr::TypeCheck() {
|
|||||||
const Type *fptrType = func->GetType();
|
const Type *fptrType = func->GetType();
|
||||||
if (fptrType == NULL)
|
if (fptrType == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Assert(dynamic_cast<const PointerType *>(fptrType) != NULL);
|
// Make sure we do in fact have a function to call
|
||||||
const FunctionType *funcType =
|
const FunctionType *funcType;
|
||||||
dynamic_cast<const FunctionType *>(fptrType->GetBaseType());
|
if (dynamic_cast<const PointerType *>(fptrType) == NULL ||
|
||||||
if (funcType == NULL) {
|
(funcType = dynamic_cast<const FunctionType *>(fptrType->GetBaseType())) == NULL) {
|
||||||
Error(pos, "Must provide function name or function pointer for "
|
Error(func->pos, "Must provide function name or function pointer for "
|
||||||
"function call expression.");
|
"function call expression.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user