aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2014-08-05 03:11:17 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-08-05 03:11:17 +0000
commitb5975cebfbe3666fe53f98e88cfbe6933978895b (patch)
tree915b12a29efd7e317841857d2c7277c76f9f8f91
parent6e4f9a957e22aaed58cf628e34d420fdfa21a3d8 (diff)
downloadgcc-b5975cebfbe3666fe53f98e88cfbe6933978895b.zip
gcc-b5975cebfbe3666fe53f98e88cfbe6933978895b.tar.gz
gcc-b5975cebfbe3666fe53f98e88cfbe6933978895b.tar.bz2
re PR go/61308 (gccgo: ICE in Expression::check_bounds [GoSmith])
PR go/61308 compiler: Handle enclosing vars for function type in function lit. This fixes a dumb bug in which the enclosing vars were incorrectly cleared when a function literal contains a reference to a function type. The test for this will go into the master repository in the change at http://codereview.appspot.com/121200043 . From-SVN: r213618
-rw-r--r--gcc/go/gofrontend/parse.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index 90f1a34..fd54edf 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -2870,7 +2870,10 @@ Parse::function_lit()
// For a function literal, the next token must be a '{'. If we
// don't see that, then we may have a type expression.
if (!this->peek_token()->is_op(OPERATOR_LCURLY))
- return Expression::make_type(type, location);
+ {
+ hold_enclosing_vars.swap(this->enclosing_vars_);
+ return Expression::make_type(type, location);
+ }
bool hold_is_erroneous_function = this->is_erroneous_function_;
if (fntype_is_error)