expression_t *array_index = designator->array_index;
assert(designator->array_index != NULL);
assert(is_type_array(type));
- assert(is_type_valid(array_index->base.type));
long index = fold_constant(array_index);
ir_type *arr_type = get_ir_type(type);
long fold_constant(const expression_t *expression)
{
+ assert(is_type_valid(skip_typeref(expression->base.type)));
+
bool constant_folding_old = constant_folding;
constant_folding = true;
expression_t *array_index = designator->array_index;
assert(designator->array_index != NULL);
assert(is_type_array(type));
- assert(is_type_valid(array_index->base.type));
long index = fold_constant(array_index);
assert(index >= 0);
value->base.type = revert_automatic_type_conversion(value);
type_t *orig_type = value->base.type;
- if (!is_type_valid(orig_type))
+ if (!is_type_valid(skip_typeref(orig_type)))
return;
set_address_taken(value, false);
/* This check does not prevent the error message in all cases of an
* prior error while parsing the expression. At least it catches the
* common case of a mistyped enum entry. */
- if (is_type_valid(end_range->base.type)) {
+ if (is_type_valid(skip_typeref(end_range->base.type))) {
errorf(pos, "case range does not reduce to an integer constant");
}
statement->case_label.is_bad = true;