Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / go.test / test / fixedbugs / bug196.go
blobea8ab0dc193c71e82686a814d0c8fbd11e36b2bb
1 // $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug196
3 // Copyright 2009 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.
7 package main
9 var m = map[int]int{0: 0, 1: 0}
10 var nf = 0
11 var i int
13 func multi() (int, int) { return 1, 2 }
15 func xxx() {
16 var c chan int
17 x, ok := <-c
19 var m map[int]int
20 x, ok = m[1]
22 var i interface{}
23 var xx int
24 xx, ok = i.(int)
26 a, b := multi()
28 _, _, _, _, _ = x, ok, xx, a, b
31 func f() map[int]int {
32 nf++
33 return m
36 func g() *int {
37 nf++
38 return &i
41 func main() {
42 f()[0]++
43 f()[1] += 2
44 *g() %= 2
45 if nf != 3 {
46 println("too many calls:", nf)
47 panic("fail")