Josh Bleecher Snyder | 03c0f3f | 2014-05-12 17:10:36 -0400 | [diff] [blame] | 1 | // runoutput |
| 2 | |
| 3 | // Copyright 2014 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 | // Issue 7316 |
| 8 | // This test exercises all types of numeric conversions, which was one |
| 9 | // of the sources of etype mismatch during register allocation in 8g. |
| 10 | |
| 11 | package main |
| 12 | |
| 13 | import "fmt" |
| 14 | |
| 15 | const tpl = ` |
| 16 | func init() { |
| 17 | var i %s |
| 18 | j := %s(i) |
| 19 | _ = %s(j) |
| 20 | } |
| 21 | ` |
| 22 | |
| 23 | func main() { |
| 24 | fmt.Println("package main") |
| 25 | ntypes := []string{ |
| 26 | "byte", "rune", "uintptr", |
| 27 | "float32", "float64", |
| 28 | "int", "int8", "int16", "int32", "int64", |
| 29 | "uint", "uint8", "uint16", "uint32", "uint64", |
| 30 | } |
| 31 | for i, from := range ntypes { |
| 32 | for _, to := range ntypes[i:] { |
| 33 | fmt.Printf(tpl, from, to, from) |
| 34 | } |
| 35 | } |
| 36 | fmt.Println("func main() {}") |
| 37 | } |