diff options
author | Matthew Dempsky <mdempsky@google.com> | 2018-04-07 03:08:46 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2018-04-09 23:19:45 +0000 |
commit | fe77a5413e64049af456b14ae911102681bee006 (patch) | |
tree | 60cf4b2f182f22bf1afbf86b1376bc6aea4669cf /test/const1.go | |
parent | c3473c4f10c93189cf312576df2ce05202948e52 (diff) | |
download | go-fe77a5413e64049af456b14ae911102681bee006.tar.gz go-fe77a5413e64049af456b14ae911102681bee006.zip |
cmd/compile: fix constant pointer comparison failure
Previously, constant pointer-typed expressions could use either Mpint
or NilVal as their Val depending on their construction, but const.go
expects each type to have a single corresponding Val kind.
This CL changes pointer-typed expressions to exclusively use Mpint.
Fixes #21221.
Change-Id: I6ba36c9b11eb19a68306f0b296acb11a8c254c41
Reviewed-on: https://go-review.googlesource.com/105315
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
Diffstat (limited to 'test/const1.go')
-rw-r--r-- | test/const1.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/const1.go b/test/const1.go index 58bddee7e0..62abe4145a 100644 --- a/test/const1.go +++ b/test/const1.go @@ -90,5 +90,5 @@ func main() { const ptr = nil // ERROR "const.*nil" const _ = string([]byte(nil)) // ERROR "is not a? ?constant" const _ = uintptr(unsafe.Pointer((*int)(nil))) // ERROR "is not a? ?constant" -const _ = unsafe.Pointer((*int)(nil)) // ERROR "cannot be nil|invalid constant type" -const _ = (*int)(nil) // ERROR "cannot be nil|invalid constant type" +const _ = unsafe.Pointer((*int)(nil)) // ERROR "cannot be nil|invalid constant type|is not a constant" +const _ = (*int)(nil) // ERROR "cannot be nil|invalid constant type|is not a constant" |