Source file test/fixedbugs/issue66585.go

     1  // run
     2  
     3  // Copyright 2024 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  var x = 0
    10  var a = foo()
    11  var b = x
    12  
    13  func foo() int {
    14  	x++
    15  	return x
    16  }
    17  
    18  func main() {
    19  	if a != 1 {
    20  		panic("unexpected a value")
    21  	}
    22  	if b != 1 {
    23  		panic("unexpected b value")
    24  	}
    25  }
    26  

View as plain text