-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.genericsIssue is related to genericsIssue is related to generics
Milestone
Description
What version of Go are you using (go version)?
go1.18-16d6a5233a Tue Jan 25 00:39:08 2022 +0000. Using gotipplay.golang.org.
Does this issue reproduce with the latest release?
No.
What operating system and processor architecture are you using (go env)?
I am using gotipplay.golang.org.
What did you do?
func Sum[Slice ~[]int](aslice Slice) int {
p := (*[]int)(&aslice) // compile error: cannot convert &slice (value of type *Slice) to type *[]int
result := 0
for _, y := range *p {
result += y
}
return result
}
What did you expect to see?
I expect p to be a *[]int
What did you see instead?
A compile error. cannot convert &slice (value of type *Slice) to type *[]int.
Metadata
Metadata
Assignees
Labels
NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.genericsIssue is related to genericsIssue is related to generics
Type
Projects
Status
No status