Skip to content

spec: definition for iota doesn't make sense for nested ConstDecls #15550

@mdempsky

Description

@mdempsky

This program should print 1, but cmd/compile rejects it with an "undefined: iota" error.

package main

import (
        "fmt"
        "unsafe"
)

const (
        _ = unsafe.Sizeof(func() int {
                const (
                        _ = 1
                        _
                        _
                )
                return 0
        }())

        y = iota
)

func main() {
        fmt.Println(y)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions