Source file test/fixedbugs/issue30566b.go

     1  // run
     2  
     3  // Copyright 2019 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  package main
     8  
     9  import (
    10  	"bytes"
    11  	"fmt"
    12  )
    13  
    14  func main() {
    15  	_, _ = false || g(1), g(2)
    16  	if !bytes.Equal(x, []byte{1, 2}) {
    17  		panic(fmt.Sprintf("wanted [1,2], got %v", x))
    18  	}
    19  }
    20  
    21  var x []byte
    22  
    23  //go:noinline
    24  func g(b byte) bool {
    25  	x = append(x, b)
    26  	return false
    27  }
    28  

View as plain text