Skip to content

cmd/compile: confusing error message when using an indexing expression as an array size #60812

@zigo101

Description

@zigo101

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

$ go version
go version go1.20.5 linux/amd64

Does this issue reproduce with the latest release?

Yes

What did you do?

package main

const S = "Go"

type T [S[0]]int // syntax error: type parameters must be named

func main() {}

What did you expect to see?

syntax error: array length must be a constant

or

syntax error: type constraint is incomplete

or

syntax error: either type constraint is incomplete or array length is not a constant

What did you see instead?

syntax error: type parameters must be named

Metadata

Metadata

Assignees

Labels

FixPendingIssues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgecompiler/runtimeIssues related to the Go compiler and/or runtime.genericsIssue is related to generics

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions