From: Ian Lance Taylor Date: Tue, 5 Aug 2014 03:11:17 +0000 (+0000) Subject: re PR go/61308 (gccgo: ICE in Expression::check_bounds [GoSmith]) X-Git-Tag: releases/gcc-5.1.0~5658 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b5975cebfbe3666fe53f98e88cfbe6933978895b;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index 90f1a3405c11..fd54edfadfa9 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)