test/fixedbugs/issue47771.go
raw| 1 | // run |
| 2 | |
| 3 | // Copyright 2021 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 | // gofrontend miscompiled some cases of append(s, make(typ, ln)...). |
| 8 | |
| 9 | package main |
| 10 | |
| 11 | var g int |
| 12 | |
| 13 | func main() { |
| 14 | a := []*int{&g, &g, &g, &g} |
| 15 | a = append(a[:0], make([]*int, len(a) - 1)...) |
| 16 | if len(a) != 3 || a[0] != nil || a[1] != nil || a[2] != nil { |
| 17 | panic(a) |
| 18 | } |
| 19 | } |