/* A dynamic array has no explicit
index type
*/
- expp->nd_type = int_type;
+ expp->nd_type = intorcard_type;
}
else cstcall(expp, S_MAX);
break;
}
if (expp->nd_symb == '[') {
- /* Handle ARRAY selection specially too! */
+ /* Handle ARRAY selection specially too!
+ */
if (tpl->tp_fund != T_ARRAY) {
node_error(expp,
"array index not belonging to an ARRAY");
return 0;
}
- if (!TstCompat(tpl->next, tpr)) {
+
+ if ((tpl->next && !TstCompat(tpl->next, tpr)) ||
+ (!tpl->next && !TstCompat(intorcard_type, tpr)) {
node_error(expp, "incompatible index type");
- return 0;
}
+
expp->nd_type = tpl->arr_elem;
return 1;
}
/* We already saw a definition of this type
in the definition module.
*/
- if (!TstTypeEquiv(tp, df->df_type)) {
+ if (!TstProcEquiv(tp, df->df_type)) {
error("inconsistent procedure declaration for \"%s\"", df->df_idf->id_text);
}
FreeType(df->df_type);
chk_expr(nd);
- if (nd->nd_type != bool_type) {
+ if (nd->nd_type != bool_type && nd->nd_type != error_type) {
node_error(nd, "boolean expression expected");
}