1 // expected: duplicate case in switch
2 //
3 // Two case clauses with the same constant value can never both run. go/types
4 // rejects it on the legacy side; stage4 compiled the second clause silently.
5 // Values written differently (1 and 0x1) are the same case.
6 package main
7 8 const K = 2
9 10 func main() {
11 x := int32(1)
12 switch x {
13 case 1:
14 println(1)
15 case 0x1:
16 println(2)
17 case K:
18 println(3)
19 case 2:
20 println(4)
21 }
22 }
23