The Go specification only accepts the NOT operator on boolean
types.
Fixes issue 10.
From-SVN: r187262
return Expression::make_error(this->location());
}
- if (op == OPERATOR_PLUS || op == OPERATOR_MINUS
- || op == OPERATOR_NOT || op == OPERATOR_XOR)
+ if (op == OPERATOR_PLUS || op == OPERATOR_MINUS || op == OPERATOR_XOR)
{
Numeric_constant nc;
if (expr->numeric_constant_value(&nc))
else
go_unreachable();
- case OPERATOR_NOT:
case OPERATOR_XOR:
break;
+ case OPERATOR_NOT:
case OPERATOR_AND:
case OPERATOR_MULT:
return false;
break;
case OPERATOR_NOT:
+ if (!type->is_boolean_type())
+ this->report_error(_("expected boolean type"));
+ break;
+
case OPERATOR_XOR:
if (type->integer_type() == NULL
&& !type->is_boolean_type())