Skip to content

cmd/compile: type inference fails on a case which looks simple #63750

@zigo101

Description

@zigo101

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

$ go version
go version go1.21.3 linux/amd64

Does this issue reproduce with the latest release?

What did you do?

package main

func foo[C ~*T | ~[]T, T any](v C) {} // compiles

func main() {
	foo(new(int))       // cannot infer T
	foo(make([]int, 3)) // cannot infer T
}

What did you expect to see?

Compiles.

What did you see instead?

Fails to compile.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions