Merge remote-tracking branch 'origin/topic/jsiwek/gh-286'

Added note about different behaviour to NEWS.

Closes #286.

* origin/topic/jsiwek/gh-286:
  GH-286: Check for record type mismatch in ternary operator
This commit is contained in:
Robin Sommer 2019-03-13 18:01:36 +00:00
commit e2172018ee
5 changed files with 41 additions and 12 deletions

View file

@ -2337,7 +2337,13 @@ CondExpr::CondExpr(Expr* arg_op1, Expr* arg_op2, Expr* arg_op3)
ExprError("operands must be of the same type");
else
SetType(op2->Type()->Ref());
{
if ( IsRecord(bt2) && IsRecord(bt3) &&
! same_type(op2->Type(), op3->Type()) )
ExprError("operands must be of the same type");
else
SetType(op2->Type()->Ref());
}
}
}