Source file test/fixedbugs/issue41239.go

     1  // run
     2  
     3  // Copyright 2020 The Go Authors. All rights reserved.  Use of this
     4  // source code is governed by a BSD-style license that can be found in
     5  // the LICENSE file.
     6  
     7  package main
     8  
     9  import "fmt"
    10  
    11  func main() {
    12  	const N = 1024
    13  	var a [N]int
    14  	x := cap(append(a[:N-1:N], 9, 9))
    15  	y := cap(append(a[:N:N], 9))
    16  	if x != y {
    17  		panic(fmt.Sprintf("different capacity on append: %d vs %d", x, y))
    18  	}
    19  }
    20  

View as plain text