| 1 |
// compile |
| 2 |
|
| 3 |
// Copyright 2018 The Go Authors. All rights reserved. |
| 4 |
// Use of this source code is governed by a BSD-style |
| 5 |
// license that can be found in the LICENSE file. |
| 6 |
|
| 7 |
// Non-constant duplicate keys/cases should not be reported |
| 8 |
// as errors by the compiler. |
| 9 |
|
| 10 |
package p |
| 11 |
|
| 12 |
import "unsafe" |
| 13 |
|
| 14 |
func f() { |
| 15 |
_ = map[uintptr]int{ |
| 16 |
0: 0, |
| 17 |
uintptr(unsafe.Pointer(nil)): 0, |
| 18 |
} |
| 19 |
|
| 20 |
switch uintptr(0) { |
| 21 |
case 0: |
| 22 |
case uintptr(unsafe.Pointer(nil)): |
| 23 |
} |
| 24 |
|
| 25 |
switch interface{}(nil) { |
| 26 |
case nil: |
| 27 |
case nil: |
| 28 |
} |
| 29 |
|
| 30 |
_ = map[interface{}]int{ |
| 31 |
nil: 0, |
| 32 |
nil: 0, |
| 33 |
} |
| 34 |
} |