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

Open
griesemer opened this Issue Jul 30, 2015 · 1 comment

Comments

Projects
None yet
3 participants
@griesemer
Contributor

griesemer 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

@gopherbot

This comment has been minimized.

gopherbot commented Jul 30, 2015

CL https://golang.org/cl/12860 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 …
…'imag'

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

Change-Id: Ifb0053c498cee9f3473c396f9338d82bd856c110
Reviewed-on: https://go-review.googlesource.com/12860
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>

@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