Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: accepts invalid function type #11595

Closed
dvyukov opened this issue Jul 4, 2015 · 5 comments
Closed

cmd/compile: accepts invalid function type #11595

dvyukov opened this issue Jul 4, 2015 · 5 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 4, 2015

gc successfully compiles the following code:

package a
var f func((i), _ int)

both gccgo and gotype reject it saying:

error: invalid named/anonymous mix
expected identifier

Spec does not allow parenthesis there.
go version devel +be2a3e2 Thu Jul 2 08:29:33 2015 +0000 linux/amd64

@dvyukov
Copy link
Member Author

dvyukov commented Jul 4, 2015

@griesemer for spec treatment

@griesemer
Copy link
Contributor

The spec does allow parentheses around types, but not around parameter names; e.g.: func((int), (float32)) ((int)) is valid.

The example above is incorrect because it mixes parameters with names (_) and w/o names (1st parameter).

@ianlancetaylor ianlancetaylor added this to the Go1.6 milestone Jul 10, 2015
@rsc rsc modified the milestones: Unplanned, Go1.6 Nov 4, 2015
@odeke-em
Copy link
Member

I can't seem to reproduce this issue on my setup
screen shot 2016-07-24 at 1 20 29 am

@odeke-em
Copy link
Member

To be clear, the problem still exists on go1.6.2 but on tip (go1.7) but seems fixed
https://play.golang.org/p/QI6Cmo92sN

@griesemer
Copy link
Contributor

This may have been fixed a while back with https://go-review.googlesource.com/20748 . Closing.

@golang golang locked and limited conversation to collaborators Aug 11, 2017
@rsc rsc removed their assignment Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants