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: allow interface pointers to be used as pointers to subset interface types in calls, rather than being unable to obtain addresses #63304

Closed
qiulaidongfeng opened this issue Sep 30, 2023 · 2 comments

Comments

@qiulaidongfeng
Copy link
Contributor

What version of Go are you using (go version)?

$ go version
tip

Does this issue reproduce with the latest release?

yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

https://go.dev/play/p/tdRYybgfMzt?v=gotip

What did you expect to see?

I hope to see the compilation pass.

I think local variables should be able to obtain addresses.

What did you see instead?

./prog.go:23:7: invalid operation: cannot take address of I1(j) (value of type I1)

@qiulaidongfeng qiulaidongfeng changed the title Allow interface pointers to be used as pointers to subset interface types in calls, rather than being unable to obtain addresses cmd/compile: allow interface pointers to be used as pointers to subset interface types in calls, rather than being unable to obtain addresses Sep 30, 2023
@go101
Copy link

go101 commented Sep 30, 2023

Now, intermediate values can't be taken addresses in Go: https://go101.org/article/unofficial-faq.html#unaddressable-values

@thanm
Copy link
Contributor

thanm commented Sep 30, 2023

Hi @qiulaidongfeng this seems more like a language question as opposed to a compiler bug -- the compiler is being consistent with the way the language is defined. If you have questions about addressability in Go, probably best to consult a forum like golang-nuts mailing list.

@thanm thanm closed this as completed Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants