Issue an error if an array of references is declared.
(More malformed program fixes.)
This commit is contained in:
10
decl.cpp
10
decl.cpp
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user