Skip to content

cmd/compile: inline static init cause compile time error #58439

@cuonglm

Description

@cuonglm

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

$ go version
go version go1.20 linux/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env

What did you do?

package main

var x = f(-1)
var y = f(64)

func f(x int) int {
	return 1 << x
}

func main() {
	println(x, y)
}

What did you expect to see?

Runtime error.

What did you see instead?

Compile time error.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions