You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following up on #38690, this code is valid and accepted by go/types, but cmd/compile fails to accept it:
package p
type t struct{ _ u }
type u [10]int
func f(x int) t { return t{u{1 / x, 1 % x}} }
func g(p *int) t { return t{u{*p}} }
func h(s []int) t { return t{u{s[0]}} }
These are expressions where candiscard(value) returns false.
Note that only one error message is printed, but that's because we hit a Fatalf after the error (use go tool compile -d panic to see it). You can also comment out some of the functions or shuffle their order to see that any of them alone triggers the failure.
Fails to compile in Go 1.14 too, so not a regression.
Slightly better test case that provides better coverage of splitnode:
package p
type t struct{ _ u }
type u [10]struct{ f int }
func f(x int) t { return t{u{{1 / x}, {1 % x}}} }
func g(p *int) t { return t{u{{*p}}} }
func h(s []int) t { return t{u{{s[0]}}} }
Following up on #38690, this code is valid and accepted by go/types, but cmd/compile fails to accept it:
These are expressions where
candiscard(value)
returns false.Note that only one error message is printed, but that's because we hit a Fatalf after the error (use
go tool compile -d panic
to see it). You can also comment out some of the functions or shuffle their order to see that any of them alone triggers the failure.Fails to compile in Go 1.14 too, so not a regression.
/cc @cuonglm
The text was updated successfully, but these errors were encountered: