modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/bug244.go (about)

     1  // run
     2  
     3  // Copyright 2010 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 nf int
    10  var ng int
    11  
    12  func f() (int, int, int) {
    13  	nf++
    14  	return 1, 2, 3
    15  }
    16  
    17  func g() int {
    18  	ng++
    19  	return 4
    20  }
    21  
    22  var x, y, z = f()
    23  var m = make(map[int]int)
    24  var v, ok = m[g()]
    25  
    26  func main() {
    27  	if x != 1 || y != 2 || z != 3 || nf != 1 || v != 0 || ok != false || ng != 1 {
    28  		println("x=", x, " y=", y, " z=", z, " nf=", nf, " v=", v, " ok=", ok, " ng=", ng)
    29  		panic("fail")
    30  	}
    31  }