Skip to content

Commit 11e249a

Browse files
Chris Manghaneianlancetaylor
Chris Manghane
authored andcommitted
compiler: Report errors after evaluating invalid constant.
The fix for golang/go#11541 made the assertion that getting an invalid Numeric_constant after evaluating an invalid constant must result in an error in a binary expression. However, a Numeric_constant can be invalid if it is unset, which occurs when either operand cannot be converted to the right type. These errors are issued after the Numeric_constant is lowered. Fixes golang/go#12615. Change-Id: I54e41d748a325004fde59f9e4e02d9c40f8f6576 Reviewed-on: https://go-review.googlesource.com/14646 Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent 302d8ab commit 11e249a

File tree

1 file changed

+0
-7
lines changed

1 file changed

+0
-7
lines changed

go/expressions.cc

-7
Original file line numberDiff line numberDiff line change
@@ -4909,14 +4909,7 @@ Binary_expression::do_lower(Gogo* gogo, Named_object*,
49094909
Numeric_constant nc;
49104910
if (!Binary_expression::eval_constant(op, &left_nc, &right_nc,
49114911
location, &nc))
4912-
{
4913-
if (nc.is_invalid())
4914-
{
4915-
go_assert(saw_errors());
4916-
return Expression::make_error(location);
4917-
}
49184912
return this;
4919-
}
49204913
return nc.expression(location);
49214914
}
49224915
}

0 commit comments

Comments
 (0)