Skip to content

Commit 80c0558

Browse files
author
ian
committed
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. Reviewed-on: https://go-review.googlesource.com/14646 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229098 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 6b5e0fa commit 80c0558

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

gcc/go/gofrontend/MERGE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
302d8abbc499e28088d758ae8b2c024d8e50b9b3
1+
11e249a59e8c627fe9c2938c38e39cb1efefb1fb
22

33
The first line of this file holds the git revision number of the last
44
merge done from the gofrontend repository.

gcc/go/gofrontend/expressions.cc

Lines changed: 0 additions & 7 deletions
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)