compiler: Don't inherit logical operator operand type from context.

From-SVN: r203337
This commit is contained in:
Ian Lance Taylor 2013-10-10 03:28:22 +00:00
parent 156dbd1552
commit 3d317d48a7

View File

@ -5606,6 +5606,15 @@ Binary_expression::do_determine_type(const Type_context* context)
subcontext.type = NULL;
}
if (this->op_ == OPERATOR_ANDAND || this->op_ == OPERATOR_OROR)
{
// For a logical operation, the context does not determine the
// types of the operands. The operands must be some boolean
// type but if the context has a boolean type they do not
// inherit it. See http://golang.org/issue/3924.
subcontext.type = NULL;
}
// Set the context for the left hand operand.
if (is_shift_op)
{