Skip to content

cmd/compile: type parameter unexpectedly does not implement constraint #56716

@silviucm

Description

@silviucm

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

$ go version
go version go1.19.3 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=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOVERSION="go1.19.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

Run the issue reported at
https://groups.google.com/g/golang-nuts/c/_-vNSfDmPG8?pli=1
both on the playground
https://go.dev/play/p/GS_x9Y8HOMK
as well as locally with go run [temp go file]

@ianlancetaylor suggested in that Google group thread that there is merit to record this as a bug, to be further looked at.
It felt interesting so I recorded it, despite not being the original submitter from the group (apologies if duplicate).

What did you expect to see?

Potentially the program successfully build

What did you see instead?

command-line-arguments
./test.go:22:41: []T does not implement Scalar|Vector ([]T missing in int | float32 | float64 | []int | []float32 | []float64)
./test.go:24:19: []T does not implement Scalar|Vector ([]T missing in int | float32 | float64 | []int | []float32 | []float64)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.genericsIssue is related to generics

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions