Prohibit returning functions from functions.

(Fix malformed program crasher)
This commit is contained in:
Matt Pharr
2012-02-06 13:59:02 -08:00
parent f939015b97
commit b7c5af7e64

View File

@@ -447,6 +447,10 @@ Declarator::GetType(const Type *base, DeclSpecs *ds) const {
Error(pos, "No return type provided in function declaration.");
return NULL;
}
if (dynamic_cast<const FunctionType *>(returnType) != NULL) {
Error(pos, "Illegal to return function type from function.");
return NULL;
}
bool isExported = ds && (ds->storageClass == SC_EXPORT);
bool isExternC = ds && (ds->storageClass == SC_EXTERN_C);