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>
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)
panic("wrong value")
}
}
+ {
+ var i int
+ v := new(i > 0) // untyped expression, see issue #75617
+ if *v != false {
+ panic("wrong value")
+ }
+ }
}