| 1 |
// Copyright 2016 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package a |
| 6 |
|
| 7 |
type T struct { |
| 8 |
} |
| 9 |
|
| 10 |
func F() []T { |
| 11 |
return []T{T{}} |
| 12 |
} |
| 13 |
|
| 14 |
func Fi() []T { |
| 15 |
return []T{{}} // element with implicit composite literal type |
| 16 |
} |
| 17 |
|
| 18 |
func Fp() []*T { |
| 19 |
return []*T{&T{}} |
| 20 |
} |
| 21 |
|
| 22 |
func Fip() []*T { |
| 23 |
return []*T{{}} // element with implicit composite literal type |
| 24 |
} |
| 25 |
|
| 26 |
func Gp() map[int]*T { |
| 27 |
return map[int]*T{0: &T{}} |
| 28 |
} |
| 29 |
|
| 30 |
func Gip() map[int]*T { |
| 31 |
return map[int]*T{0: {}} // element with implicit composite literal type |
| 32 |
} |
| 33 |
|
| 34 |
func Hp() map[*T]int { |
| 35 |
return map[*T]int{&T{}: 0} |
| 36 |
} |
| 37 |
|
| 38 |
func Hip() map[*T]int { |
| 39 |
return map[*T]int{{}: 0} // key with implicit composite literal type |
| 40 |
} |