Issue an error if an array of references is declared.

(More malformed program fixes.)
This commit is contained in:
Matt Pharr
2012-02-06 14:28:38 -08:00
parent 420d373d89
commit 8e2b0632e8

View File

@@ -355,6 +355,11 @@ Declarator::GetType(const Type *base, DeclSpecs *ds) const {
Error(pos, "Arrays of \"void\" type are illegal.");
return NULL;
}
if (dynamic_cast<const ReferenceType *>(type)) {
Error(pos, "Arrays of references (type \"%s\") are illegal.",
type->GetString().c_str());
return NULL;
}
type = new ArrayType(type, arraySize);
if (child)
@@ -472,6 +477,11 @@ Declarator::GetType(const Type *base, DeclSpecs *ds) const {
return NULL;
}
if (child == NULL) {
Assert(m->errorCount > 0);
return NULL;
}
const Type *functionType =
new FunctionType(returnType, args, argNames, argDefaults,
argPos, isTask, isExported, isExternC);