(void) get_ir_type(type);
return NULL;
}
- if (!is_type_scalar(type)) {
- /* make sure firm type is constructed */
- (void) get_ir_type(type);
- return value_node;
- }
from_type = skip_typeref(from_type);
ir_mode *mode = get_ir_mode_storage(type);
type_t *const init_type = skip_typeref(value->base.type);
if (!is_type_scalar(init_type)) {
- /* skip convs */
- while (value->kind == EXPR_UNARY_CAST)
- value = value->unary.value;
-
if (value->kind != EXPR_COMPOUND_LITERAL)
panic("expected non-scalar initializer to be a compound literal");
initializer = value->compound_literal.initializer;
static expression_t *create_implicit_cast(expression_t *expression,
type_t *dest_type)
{
- type_t *const source_type = expression->base.type;
-
- if (source_type == dest_type)
+ type_t *const source_type = skip_typeref(expression->base.type);
+ if (source_type == skip_typeref(dest_type))
return expression;
expression_t *cast = allocate_expression_zero(EXPR_UNARY_CAST);
expression_t const *const right = expression->right;
/* The type of the right operand can be different for /= */
- if (is_type_integer(right->base.type) &&
+ if (is_type_integer(skip_typeref(right->base.type)) &&
is_constant_expression(right) == EXPR_CLASS_CONSTANT &&
!fold_constant_to_bool(right)) {
position_t const *const pos = &expression->base.pos;
type_t *type = expression_type;
if (current_switch != NULL) {
type_t *switch_type = current_switch->expression->base.type;
- if (is_type_valid(switch_type)) {
+ if (is_type_valid(skip_typeref(switch_type))) {
expression = create_implicit_cast(expression, switch_type);
}
}