This patch to the Go frontend fixes a bug when there is a composite
literal that uses a struct field where the name of the field happens to
be the same as the name of a variable in an enclosing function.  This
used to work fine, but it broke when I added a new field to function
closures as part of the change to the function representation.  I've
added a test to the master Go repository to catch this in the future.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline and 4.8 branch.

Ian

diff -r a1afec89faee go/gogo.cc
--- a/go/gogo.cc	Tue Jul 16 08:44:25 2013 -0700
+++ b/go/gogo.cc	Tue Jul 16 15:41:23 2013 -0700
@@ -3380,7 +3380,7 @@
   st->push_field(Struct_field(Typed_identifier(".$f", voidptr_type,
 					       this->location_)));
 
-  unsigned int index = 0;
+  unsigned int index = 1;
   for (Closure_fields::const_iterator p = this->closure_fields_.begin();
        p != this->closure_fields_.end();
        ++p, ++index)

Reply via email to