]> Cypherpunks repositories - gostls13.git/commit
cmd/gc: add diagnostic for var, type, const named init
authorRuss Cox <rsc@golang.org>
Sat, 22 Dec 2012 22:23:33 +0000 (17:23 -0500)
committerRuss Cox <rsc@golang.org>
Sat, 22 Dec 2012 22:23:33 +0000 (17:23 -0500)
commit3aed92f81136da6dc5848593fcf6f8b8d5c65c5e
tree76e18a086dffdbd10a658cab6155f44d849d3de5
parent3fc3597c9b0b1e5d4887771004320add2d0570f4
cmd/gc: add diagnostic for var, type, const named init

Before this CL, defining the variable worked fine, but then when
the implicit package-level init func was created, that caused a
name collision and a confusing error about the redeclaration.

Also add a test for issue 3705 (func init() needs body).

Fixes #4517.

R=ken2
CC=golang-dev
https://golang.org/cl/7008045
src/cmd/gc/dcl.c
test/fixedbugs/issue3705.go [new file with mode: 0644]
test/fixedbugs/issue4517a.go [new file with mode: 0644]
test/fixedbugs/issue4517b.go [new file with mode: 0644]
test/fixedbugs/issue4517c.go [new file with mode: 0644]