Only produce an error about the type of an array subscript, if the type is valid.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 8 Nov 2012 03:58:39 +0000 (04:58 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 8 Nov 2012 08:12:26 +0000 (09:12 +0100)
parser.c

index 8b0aadb..647d950 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -6778,7 +6778,8 @@ static expression_t *parse_array_expression(expression_t *left)
 check_idx:
                res_type = automatic_type_conversion(res_type);
                if (!is_type_integer(idx_type)) {
-                       errorf(&idx->base.source_position, "array subscript must have integer type");
+                       if (is_type_valid(idx_type))
+                               errorf(&idx->base.source_position, "array subscript must have integer type");
                } else if (is_type_atomic(idx_type, ATOMIC_TYPE_CHAR)) {
                        source_position_t const *const pos = &idx->base.source_position;
                        warningf(WARN_CHAR_SUBSCRIPTS, pos, "array subscript has char type");