-
Notifications
You must be signed in to change notification settings - Fork 17.3k
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
6g doesn't accept non-parenthesized function literal invocation as if statement condition #1685
Labels
Comments
Owner changed to @griesemer. Status changed to Accepted. |
Issue #1686 has been merged into this issue. |
Issue #1687 has been merged into this issue. |
Issue #1688 has been merged into this issue. |
This is a 6g bug. Both gofmt and gccgo accept all these versions below: package main func main() { // version 1 if func() bool { return true } () { println("hi 1") } // version 2 if (func() bool { return true }) () { println("hi 2") } // version 3 if (func() bool { return true } ()) { println("hi 3") } } 6g complains about version 1; but there is no parsing ambiguity and it is legal according to the spec. Note that gofmt doesn't remove the parentheses around the function literal in version 2 (because it is not aggressively removing all parentheses where not needed at the moment), so writing the code as in version 2 can serve as a temporary work-around for 6g. Labels changed: added compilerbug. Owner changed to @rsc. |
This issue was closed by revision 017e73c. Status changed to Fixed. |
This was referenced Dec 8, 2014
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by juhanipm:
The text was updated successfully, but these errors were encountered: