Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / go.test / test / fixedbugs / bug236.go
blob895f82a23204bb1acd51dc859a00df0693a0cedc
1 // $G $D/$F.go && $L $F.$A && ./$A.out
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 gen = 'a'
11 func f(n int) string {
12 s := string(gen) + string(n+'A'-1)
13 gen++
14 return s
17 func g(x, y string) string { return x + y }
19 var v1 = f(1) + f(2)
20 var v2 = g(f(3), f(4))
21 var v3 = f(5) + f(6) + f(7) + f(8) + f(9)
23 func main() {
24 gen = 'a'
26 if v1 != "aAbB" {
27 panic("BUG: bug236a")
29 if v2 != "cCdD" {
30 panic("BUG: bug236b")
32 if v3 != "eEfFgGhHiI" {
33 panic("BUG: bug236c")
36 switch "aAbB" {
37 case f(1) + f(2):
38 default:
39 panic("BUG: bug236d")
42 switch "cCdD" {
43 case g(f(3), f(4)):
44 default:
45 panic("BUG: bug236e")
48 switch "eEfFgGhHiI" {
49 case f(5) + f(6) + f(7) + f(8) + f(9):
50 default:
51 panic("BUG: bug236f")