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

gccgo: complex accepts complex value as 2nd argument #11948

Closed
griesemer opened this issue Jul 30, 2015 · 1 comment
Closed

gccgo: complex accepts complex value as 2nd argument #11948

griesemer opened this issue Jul 30, 2015 · 1 comment
Milestone

Comments

@griesemer
Copy link
Contributor

The following program:

package main
const x = complex(0i, 1i)
func main() {
}

compiles, links, and runs w/o errors:

$ gccgo x.go -o x && ./x

(version: gccgo (google-gccgo-219769) 5.0.0 20150116 (experimental))

The 2nd argument 1i is a complex constant with non-zero imaginary component, it should not be accepted.

Note that:

package main
const x = complex(1, 1i)
func main() {
}

leads to an error:

$ gccgo x.go -o x && ./x
x.go:2:11: error: complex arguments must have identical types
 const x = complex(1, 1i)
           ^

which is misleading (both arguments are untyped).

Furthermore:

package main
import "fmt"
const x = complex(1i, 1i)
func main() {
   fmt.Println(x)
}

compiles, links, and runs without error, but does not print anything (not even a newline):

$ gccgo x.go -o x && ./x
$
@griesemer griesemer added this to the Gccgo milestone Jul 30, 2015
@paranoiacblack paranoiacblack self-assigned this Aug 3, 2015
@paranoiacblack
Copy link
Contributor

This has the same root cause as #11566. Closng this as a duplicate; the test cases here will be sucked into the test case for #11566.

@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

3 participants