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/gc: accepts references to _ in structs #4941

Closed
nico opened this issue Feb 28, 2013 · 3 comments
Closed

cmd/gc: accepts references to _ in structs #4941

nico opened this issue Feb 28, 2013 · 3 comments
Milestone

Comments

@nico
Copy link

nico commented Feb 28, 2013

http://tip.golang.org/ref/spec#Selector says "The identifier f is called the (field
or method) selector; it must not be the blank identifier.", yet:

$ cat tst.go
package main

type foo struct {
  _ int
}

func f() int {
  a := foo{42}
  return a._
}

func main() {
  println(f())
}
$ ~/src/go/bin/go build tst.go 
$ ./tst
42

$ ~/src/go/bin/go version
go version devel +981ed43b6f82 Mon Feb 11 11:56:49 2013 +1100 darwin/amd64

Also at:
http://play.golang.org/p/Ya_L00b9iy
@rsc
Copy link
Contributor

rsc commented Feb 28, 2013

Comment 1:

whoa. nice.

@DanielMorsing
Copy link
Contributor

Comment 2:

Fix at https://golang.org/cl/7415051/

Status changed to Started.

@DanielMorsing
Copy link
Contributor

Comment 4:

This issue was closed by revision b65acae.

Status changed to Fixed.

@nico nico added fixed labels Mar 4, 2013
@rsc rsc added this to the Go1.1 milestone Apr 14, 2015
@rsc rsc removed the go1.1maybe label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

4 participants