You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following program fails with the error "cannot use generic type Pair(type A, B) without instantiation", but the type does seem to be instantiated correctly.
package main
import "fmt"
func main() {
fmt.Println(zeroS(int)())
}
type S(type T) struct {
T T
}
func zeroS(type T)() S(T) {
m := make([]S(T), 1)
return m[0]
}
Ah, interesting! I was using round brackets because originally I had more than one type parameter so couldn't use square brackets because of issue #40788. https://go2goplay.golang.org/p/v35cQ-jcbEd
commit 722af87
The following program fails with the error "cannot use generic type Pair(type A, B) without instantiation", but the type does seem to be instantiated correctly.
If we add a type alias, it works.
The text was updated successfully, but these errors were encountered: