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

cmd/compile: real and imag don't accept untyped non-complex constants as arguments #11946

griesemer opened this issue Jul 30, 2015 · 1 comment


None yet
3 participants
Copy link

commented Jul 30, 2015

package main
const _ = real(10.0)


$ go build x.go
# command-line-arguments
./x.go:2: invalid argument 10 (type float64) for real

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.

Related issues: #11540, #11945.

@griesemer griesemer modified the milestones: Unplanned, Go1.6 Jul 30, 2015


This comment has been minimized.

Copy link

commented Jul 30, 2015

CL mentions this issue.

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

spec: clarify semantics of built-in functions 'complex', 'real', and …

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

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

@rsc rsc modified the milestones: Unplanned, Go1.6 Dec 5, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.