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

x/tools/go/types: treats complex constant as integer #11564

Closed
dvyukov opened this issue Jul 3, 2015 · 2 comments
Closed

x/tools/go/types: treats complex constant as integer #11564

dvyukov opened this issue Jul 3, 2015 · 2 comments

Comments

@dvyukov
Copy link
Member

dvyukov commented Jul 3, 2015

gotype successfully compiles the following program:

package a
var e,f = f^0i,0

while gccgo says:

go.go:2:12: error: incompatible types in binary expression

gccgo seems to be right, because 0i is imaginary literal.

on commit 997b354

@dvyukov
Copy link
Member Author

dvyukov commented Jul 3, 2015

@griesemer
Copy link
Contributor

Working as intended: 0i is an untyped complex constant that can be represented accurately as an int. Both go/types and gc agree with the spec. This is a gccgo bug.

See also #11563 .

@golang golang locked and limited conversation to collaborators Jul 11, 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

3 participants