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

cmd/compile: duplicate error for invalid complex number const conversion #33921

Open
pestophagous opened this issue Aug 29, 2019 · 0 comments

Comments

@pestophagous
Copy link
Contributor

commented Aug 29, 2019

What version of Go are you using (go version)?

tip of master on gerrit.

$ go version
go version devel +d0eaec7 Wed Aug 28 21:48:01 2019 +0000 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/someone/.cache/go-build"
GOENV="/home/someone/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/someone/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/repos/go_002/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/repos/go_002/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="0"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build522812886=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

func main() {
	_ = uint(-4 + 2i)
}

https://play.golang.org/p/hIqU2ydLGdn

What did you expect to see?

A single error like "cannot convert complex to uint".

What did you see instead?

Two errors:

./prog.go:4:10: constant (-4+2i) truncated to integer
./prog.go:4:10: constant -4 overflows uint

@ALTree ALTree added this to the Unplanned milestone Aug 29, 2019

@ALTree ALTree added the NeedsFix label Aug 29, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.