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

Closed
griesemer opened this issue Jul 30, 2015 · 2 comments

Comments

@griesemer
Copy link
Contributor

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
Copy link

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

mk0x9 pushed a commit to mk0x9/go that referenced this issue Aug 5, 2015
…'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
@ALTree
Copy link
Member

ALTree commented Oct 2, 2019

This was fixed in 829adf5, so we can close this issue.

@ALTree ALTree closed this as completed Oct 2, 2019
@golang golang locked and limited conversation to collaborators Oct 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants