mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: fix compiler bug for constant equality comparison
The compiler incorrectly will error when comparing a nil pointer
interface to a nil pointer of any other type. Example:
(*int)(nil) == interface{}(nil)
Will error with "gc: illegal constant expression: *int == interface {}"
Fixes #16702
Change-Id: I1a15d651df2cfca6762b1783a28b377b2e6ff8c6
Reviewed-on: https://go-review.googlesource.com/27591
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
6fe1febc86
commit
fc5df089da
2 changed files with 38 additions and 0 deletions
|
|
@ -827,6 +827,9 @@ func evconst(n *Node) {
|
|||
|
||||
// check for compatible general types (numeric, string, etc)
|
||||
if wl != wr {
|
||||
if wl == TINTER || wr == TINTER {
|
||||
goto setfalse
|
||||
}
|
||||
goto illegal
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue