Allow multiple variable declarations with a single type
This commit is contained in:
@ -108,7 +108,8 @@ namespace gcc
|
||||
break;
|
||||
}
|
||||
argument->accept(this);
|
||||
if (!is_assignable_from(TREE_TYPE(record_fields), this->current_expression))
|
||||
tree unqualified_field = get_qualified_type(TREE_TYPE(record_fields), TYPE_UNQUALIFIED);
|
||||
if (!is_assignable_from(unqualified_field, this->current_expression))
|
||||
{
|
||||
error_at(argument_location,
|
||||
"cannot assign value of type '%s' to variable of type '%s'",
|
||||
@ -548,11 +549,11 @@ namespace gcc
|
||||
{
|
||||
expression->lhs().accept(this);
|
||||
tree left = this->current_expression;
|
||||
tree left_type = TREE_TYPE(left);
|
||||
tree left_type = get_qualified_type(TREE_TYPE(left), TYPE_UNQUALIFIED);
|
||||
|
||||
expression->rhs().accept(this);
|
||||
tree right = this->current_expression;
|
||||
tree right_type = TREE_TYPE(right);
|
||||
tree right_type = get_qualified_type(TREE_TYPE(right), TYPE_UNQUALIFIED);
|
||||
|
||||
location_t expression_location = get_location(&expression->position());
|
||||
|
||||
@ -1012,9 +1013,8 @@ namespace gcc
|
||||
error_at(statement_location, "cannot modify constant '%s'",
|
||||
statement->lvalue().is_variable()->name().c_str());
|
||||
this->current_expression = error_mark_node;
|
||||
return;
|
||||
}
|
||||
if (is_assignable_from(TREE_TYPE(lvalue), this->current_expression))
|
||||
else if (is_assignable_from(TREE_TYPE(lvalue), this->current_expression))
|
||||
{
|
||||
tree assignment = build2_loc(statement_location, MODIFY_EXPR,
|
||||
void_type_node, lvalue, this->current_expression);
|
||||
|
Reference in New Issue
Block a user