GH-286: Check for record type mismatch in ternary operator

Fixes GH-286
This commit is contained in:
Jon Siwek 2019-02-25 12:55:03 -06:00
parent a342090f18
commit 74c225c7cb
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());
}
}
}