blob: 298c4551834e1f79573aa5efb48dcd4bad8f8b6b [file] [log] [blame]
Ian Lance Taylor47b61972012-03-22 09:44:31 -07001// run
2
3// Copyright 2012 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// Test that when the compiler expands append inline it does not
8// overwrite a value before it needs it (issue 3369).
9
10package main
11
12func main() {
13 s := make([]byte, 5, 6)
14 copy(s, "12346")
15 s = append(s[:len(s)-1], '5', s[len(s)-1])
16 if string(s) != "123456" {
17 panic(s)
18 }
19}