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: complex(0, 0i) should be permitted #11669

Closed
dvyukov opened this issue Jul 11, 2015 · 5 comments
Closed

go/types: complex(0, 0i) should be permitted #11669

dvyukov opened this issue Jul 11, 2015 · 5 comments
Milestone

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 11, 2015

gc successfully compiles the following program:

package a
var e = complex(0, 0i)

while gotype rejects it with:

invalid argument: 0i (untyped complex constant 0) must be a float32, float64, or an untyped non-complex numeric constant

go version devel +9b04852 Sat Jul 11 00:08:50 2015 +0000 linux/amd64

@dvyukov
Copy link
Member Author

dvyukov commented Jul 11, 2015

@griesemer
Copy link
Contributor

I believe this is a go/types bug. 0i is untyped and can be represented as a float32 or float64. The spec could be clearer.

@griesemer griesemer changed the title cmd/compile: implicitly converts complex constant to integer go/types: complex(0, 0i) should be permitted Jul 11, 2015
@griesemer
Copy link
Contributor

Closed by mistake. Reopening.

@griesemer griesemer reopened this Jul 11, 2015
@griesemer griesemer assigned griesemer and unassigned rsc Jul 11, 2015
@griesemer griesemer added this to the Go1.6 milestone Jul 11, 2015
@gopherbot
Copy link
Contributor

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

@gopherbot
Copy link
Contributor

CL https://golang.org/cl/12937 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 <[email protected]>
Reviewed-by: Rob Pike <[email protected]>
@golang golang locked and limited conversation to collaborators Aug 22, 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

4 participants