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
Assignees
Milestone

Comments

@dvyukov
Copy link
Member

@dvyukov 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 dvyukov commented Jul 11, 2015

Loading

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jul 11, 2015

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.

Loading

@griesemer griesemer closed this Jul 11, 2015
@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

@griesemer griesemer commented Jul 11, 2015

Closed by mistake. Reopening.

Loading

@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

@gopherbot gopherbot commented Jul 29, 2015

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

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Jul 30, 2015

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

Loading

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>
@griesemer griesemer closed this in 39e77bf Aug 21, 2015
@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants