Skip to content

cmd/internal/gc: static initialization for function variables #10081

Closed
@mdempsky

Description

@mdempsky

Currently, this file:

package bug
func f() {}
var g = f

requires a dynamic initializer to assign g. This seems unnecessary though, because the compiler has already statically allocated the (empty) function closure for f, so g could just be statically initialized to point to that closure.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions