Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/types: real and imag don't accept untyped non-complex constants as arguments #11947

griesemer opened this issue Jul 30, 2015 · 2 comments


Copy link

package main
const _ = real(10.0)


$ gotype x.go
x.go:2:16: invalid argument: 10.0 (untyped float constant 10) must be a complex number

This seems inconsistent with complex(...) which accepts any untyped number as argument as long as it has no imaginary component or that component is zero. Similarly, real and float shouldn't really care about the nature of the untyped constant as long as it's a number.

gccgo accepts the above code w/o error.

@griesemer griesemer self-assigned this Jul 30, 2015
@griesemer griesemer added this to the Go1.6 milestone Jul 30, 2015
Copy link

CL mentions this issue.

mk0x9 pushed a commit to mk0x9/go that referenced this issue Aug 5, 2015

For golang#11669, golang#11540, golang#11945, golang#11946, golang#11947.

Change-Id: Ifb0053c498cee9f3473c396f9338d82bd856c110
Reviewed-by: Russ Cox <>
Reviewed-by: Rob Pike <>
Copy link

CL mentions this issue.

@golang golang locked and limited conversation to collaborators Sep 4, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet

No branches or pull requests

2 participants