summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2012-11-08 04:58:39 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2012-11-08 09:12:26 +0100
commit0ff81636cd715b890daeeaada099b09921b9e503 (patch)
tree9b74906d1fbd7625020e45fceea5cdb25d3b6293
parent09087f33b3718d194ae00c993d576c32929ba1ff (diff)
Only produce an error about the type of an array subscript, if the type is valid.
-rw-r--r--parser.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/parser.c b/parser.c
index 8b0aadb..647d950 100644
--- 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");