Skip to content

cmd/compile: internal compiler error: impure type set used in value type #60117

@kckrinke

Description

@kckrinke

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

$ go version
go version go1.20.1 linux/arm64

Does this issue reproduce with the latest release?

Yes. Confirmed with v1.20.4.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/quo/local/enjenv/golang/cache"
GOENV="/quo/local/enjenv/golang/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS="-modcacherw"
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/quo/local/enjenv/golang/modcache"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/quo"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/quo/local/enjenv/golang/go"
GOSUMDB="sum.golang.org"
GOTMPDIR="/quo/local/enjenv/golang/tmp"
GOTOOLDIR="/quo/local/enjenv/golang/go/pkg/tool/linux_arm64"
GOVCS=""
GOVERSION="go1.20.4"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/quo/src/poc/go-impure-value/go.mod"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/quo/local/enjenv/golang/tmp/go-build2070028500=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Just experimenting with using generics to solve some design pattern conveniences and discovered that I apparently need to file this bug report, so that's what this bug report is about.

Here's a short program demonstrating the problem case.

What did you expect to see?

Dunno exactly, still wrapping my brain around the generics thing and this was simply exploration through experimentation. The short program was extracted from the work I'm doing on a much larger project, which means I must be confused about the rules of generics and need to scale things back a bit.

What did you see instead?

$ cat main.go
package main

import (
	"fmt"
)

type Number interface {
	uint64 | int64 | float64
}

type Variable interface {
	Number | []interface{} | interface{}
}

func main() {
	fmt.Printf("Hello World\n")
}
$ go build -v
go-impure-value
# go-impure-value
./main.go:7:6: internal compiler error: impure type set used in value type

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions