]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR go/61308 (gccgo: ICE in Expression::check_bounds [GoSmith])
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 5 Aug 2014 03:11:17 +0000 (03:11 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 5 Aug 2014 03:11:17 +0000 (03:11 +0000)
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

gcc/go/gofrontend/parse.cc

index 90f1a3405c116bee73d4879d5c3b2fcb047d1e72..fd54edfadfa93fa398a9036ce5576acccc21e46a 100644 (file)
@@ -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)