From b5975cebfbe3666fe53f98e88cfbe6933978895b Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 5 Aug 2014 03:11:17 +0000 Subject: 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 --- gcc/go/gofrontend/parse.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/go') 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) -- cgit v1.1