mirror of
https://github.com/golang/go.git
synced 2026-02-05 18:35:03 +03:00
cmd/compile: fix ICE with new(<untyped expr>)
Fixes #75617 Change-Id: Iaee7d4556db54b9999f5ba8458e7c05c11ccfc36 Reviewed-on: https://go-review.googlesource.com/c/go/+/707075 Reviewed-by: Junyang Shao <shaojunyang@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
committed by
Gopher Robot
parent
7d7cd6e07b
commit
0f31d742cd
@@ -2434,6 +2434,7 @@ func (r *reader) expr() (res ir.Node) {
|
||||
if r.Bool() {
|
||||
// new(expr) -> tmp := expr; &tmp
|
||||
x := r.expr()
|
||||
x = typecheck.DefaultLit(x, nil) // See TODO in exprConvert case.
|
||||
var init ir.Nodes
|
||||
addr := ir.NewAddrExpr(pos, r.tempCopy(pos, x, &init))
|
||||
addr.SetInit(init)
|
||||
|
||||
@@ -29,4 +29,11 @@ func main() {
|
||||
panic("wrong value")
|
||||
}
|
||||
}
|
||||
{
|
||||
var i int
|
||||
v := new(i > 0) // untyped expression, see issue #75617
|
||||
if *v != false {
|
||||
panic("wrong value")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user