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: spurious error in equality comparison #16702

Closed
alandonovan opened this issue Aug 15, 2016 · 2 comments
Closed

cmd/compile: spurious error in equality comparison #16702

alandonovan opened this issue Aug 15, 2016 · 2 comments
Milestone

Comments

@alandonovan
Copy link
Contributor

alandonovan commented Aug 15, 2016

The gc compiler issues a spurious error for this comparison:

(*int)(nil) == interface{}(nil) // gc: illegal constant expression: *int == interface {}

For some reason it seems to consider the operands to the comparison to be constants, even though they are both nil (and thus not even values of a type that has constants).

When the operands are bound to variables, the error goes away:

func _(p *int, q interface{}) bool { return p == q }

go/types correctly reports no error.

See https://play.golang.org/p/gtgb4En-KE

$ go version
go version devel +31ad583 Wed Aug 10 19:44:08 2016 +0000 darwin/amd64
@bradfitz bradfitz changed the title gc: spurious error in equality comparison cmd/compile: spurious error in equality comparison Aug 15, 2016
@bradfitz bradfitz added this to the Go1.8 milestone Aug 15, 2016
@TreyLawrence
Copy link
Contributor

So would this just be changing const.go here and here to also check that the kind of both nodes is also not TINTER?
cc: @pbiggar @kgibilterra

@gopherbot
Copy link

CL https://golang.org/cl/27591 mentions this issue.

@golang golang locked and limited conversation to collaborators Sep 17, 2017
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

5 participants