Go patch committed: Avoid bogus init loop error

Ian Lance Taylor iant@google.com
Fri Nov 8 18:03:00 GMT 2013


Code like this

type S struct {
	F int
}

var V = S{F: 1}

var F = V.F

could trigger an incorrect "variable initializer refers to itself" error
because the Go frontend would confuse itself into thinking that the "F"
in the composite literal was the same as the global variable "F", rather
than being the name of the field "F".

This patch fixes the problem.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.patch
Type: text/x-diff
Size: 1786 bytes
Desc: patch
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20131108/3c42333d/attachment.bin>


More information about the Gcc-patches mailing list