Skip to content

spec: clarify meaning of alias decls in sequence of "enum" const declaration #17784

Closed
@griesemer

Description

@griesemer
package main

import "math"
import "fmt"

const (
	a = iota
	b
	c => math.Pi
	d
)

func main() {
	fmt.Println(a, b, c, d)
}

prints

0 1 3.141592653589793 2

It probably shouldn't be allowed in the first place. Certainly the output is wrong (iota should be incremented with each semicolon).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions