golang/go

go/types: complex(0, 0i) should be permitted

dvyukov opened this issue · 5 comments

gc successfully compiles the following program:

package a
var e = complex(0, 0i)

while gotype rejects it with:

invalid argument: 0i (untyped complex constant 0) must be a float32, float64, or an untyped non-complex numeric constant

go version devel +9b04852 Sat Jul 11 00:08:50 2015 +0000 linux/amd64

I believe this is a go/types bug. 0i is untyped and can be represented as a float32 or float64. The spec could be clearer.

Closed by mistake. Reopening.

CL https://golang.org/cl/12860 mentions this issue.

CL https://golang.org/cl/12937 mentions this issue.