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

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

Comments

@griesemer
Copy link
Contributor

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

CL https://golang.org/cl/12939 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.
Projects
None yet
Development

No branches or pull requests

2 participants