Skip to content

cmd/compile: misleading error trying to convert to pointer to type parameter #79883

Closed

Description

@dominikh

For invalid conversions such as

func foo[A [1]int]() {
	var s string
	_ = (*A)(s)
}

the compiler reports

/tmp/qux.go:5:11: cannot convert s (variable of type string) to type *A: string does not implement *A (type *A is pointer to interface, not interface)

but the issue isn't really about interfaces.

Activity

  1. gopherbot commented on Jun 6, 2026

    @gopherbot
    Contributor

    Change https://go.dev/cl/787900 mentions this issue: types2, go/types: fix conversion error for pointer to type param

  2. self-assigned this
    on Jun 9, 2026
  3. changed the title [-]cmd/compile: misleading error trying to convert to pointer to generic[/-] [+]cmd/compile: misleading error trying to convert to pointer to type parameter[/+] on Jun 10, 2026
  4. added
    BadErrorMessageIssues related compiler error messages that should be better.
    on Jun 10, 2026
  5. added
    FixPendingIssues that have a fix which has not yet been reviewed or submitted.
    on Jun 10, 2026
  6. added this to the Backlog milestone on Jun 10, 2026
  7. modified the milestones: Backlog, Go1.27 on Jun 15, 2026
  8. moved this from In Progress to All-But-Submitted in Go Compiler / Runtime / Commandon Jun 15, 2026
  9. moved this from All-But-Submitted to In Progress in Go Compiler / Runtime / Commandon Jun 16, 2026
  10. moved this from In Progress to All-But-Submitted in Go Compiler / Runtime / Commandon Jun 23, 2026
  11. added a commit that references this issue on Jun 23, 2026
    674ceb7
  12. added a commit that references this issue on Jul 21, 2026
    e59f0d5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BadErrorMessageIssues related compiler error messages that should be better.FixPendingIssues that have a fix which has not yet been reviewed or submitted.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions