mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00: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:
parent
7d7cd6e07b
commit
0f31d742cd
2 changed files with 8 additions and 0 deletions
|
|
@ -2434,6 +2434,7 @@ func (r *reader) expr() (res ir.Node) {
|
||||||
if r.Bool() {
|
if r.Bool() {
|
||||||
// new(expr) -> tmp := expr; &tmp
|
// new(expr) -> tmp := expr; &tmp
|
||||||
x := r.expr()
|
x := r.expr()
|
||||||
|
x = typecheck.DefaultLit(x, nil) // See TODO in exprConvert case.
|
||||||
var init ir.Nodes
|
var init ir.Nodes
|
||||||
addr := ir.NewAddrExpr(pos, r.tempCopy(pos, x, &init))
|
addr := ir.NewAddrExpr(pos, r.tempCopy(pos, x, &init))
|
||||||
addr.SetInit(init)
|
addr.SetInit(init)
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,11 @@ func main() {
|
||||||
panic("wrong value")
|
panic("wrong value")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
var i int
|
||||||
|
v := new(i > 0) // untyped expression, see issue #75617
|
||||||
|
if *v != false {
|
||||||
|
panic("wrong value")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue