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
For real and imag, the argument must be of complex type, and the return type is the corresponding floating-point type: float32 for a complex64 argument, and float64 for a complex128 argument. If the argument evaluates to an untyped constant, it must be a number, and the return value of the function is an untyped floating-point constant.
$ cat /tmp/cplx.go
package cplx
const (
a int = real(0i)
b = imag(0)
)
$ go tool compile /tmp/cplx.go
/tmp/cplx.go:4: cannot use real(0i) (type float64) as type int in const initializer
/tmp/cplx.go:5: invalid argument 0 (type int) for imag
$ gccgo-4.8 -c /tmp/cplx.go
$ gotype /tmp/cplx.go
The text was updated successfully, but these errors were encountered:
Go spec says:
The text was updated successfully, but these errors were encountered: