Skip to content

cmd/compile: "relocation target not defined" for constant of instantiated type #51245

@findleyr

Description

@findleyr

Compiling the following code:

package main

type T[P any] int

const C T[int] = 3

func main() {
}

Yields the following linker error:

go.constinfo.main: relocation target go.info.main.T[int] not defined

https://go.dev/play/p/sR5foIWLFEg?v=gotip

This looks like a valid program to me, so I think this is a bug (at the very least, the error message could be improved).

CC @danscales @randall77 @mdempsky @griesemer

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.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions