* Go patch committed: Fix enclosing vars for func type in func lit
@ 2014-08-05 3:11 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2014-08-05 3:11 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 402 bytes --]
This patch to the Go frontend 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 has been committed to
the master repository: http://codereview.appspot.com/121200043 . This
fixes PR 61308. Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu. Committed to mainline and 4.9 branch.
Ian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 598 bytes --]
diff -r d7e00d7c498b go/parse.cc
--- a/go/parse.cc Mon Aug 04 19:56:11 2014 -0700
+++ b/go/parse.cc Mon Aug 04 19:58:30 2014 -0700
@@ -2870,7 +2870,10 @@
// 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)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-08-05 3:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-05 3:11 Go patch committed: Fix enclosing vars for func type in func lit Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).