Merge from mainline (167278:168000).
[official-gcc/graphite-test-results.git] / gcc / testsuite / go.test / test / convert.go
blobe7361aa87f8f1e0f6e97d04dc277a098009afc6d
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 import "reflect"
11 func typeof(x interface{}) string { return reflect.Typeof(x).String() }
13 func f() int { return 0 }
15 func g() int { return 0 }
17 type T func() int
19 var m = map[string]T{"f": f}
21 type A int
22 type B int
24 var a A = 1
25 var b B = 2
26 var x int
28 func main() {
29 want := typeof(g)
30 if t := typeof(f); t != want {
31 println("type of f is", t, "want", want)
32 panic("fail")
35 want = typeof(a)
36 if t := typeof(+a); t != want {
37 println("type of +a is", t, "want", want)
38 panic("fail")
40 if t := typeof(a + 0); t != want {
41 println("type of a+0 is", t, "want", want)
42 panic("fail")