golang/go

go/types: allows duplicate switch cases

dvyukov opened this issue · 3 comments

go/types accepts the following program:

package a
func f() {
    switch 0 {
        case 0:
        case 0:
    }
}

While both gc and gccgo reject it with duplicate case 0 in switch.
Compilers should agree on validity of this program.

on commit 997b354

Note that the spec doesn't specify that this is prohibited (but it should). See also #4524.

CL https://golang.org/cl/13285 mentions this issue.