| // Copyright 2012 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // conversions |
| |
| package conversions |
| |
| // argument count |
| var ( |
| _ = int /* ERROR "one argument" */ () |
| _ = int /* ERROR "one argument" */ (1, 2) |
| ) |
| |
| func string_conversions() { |
| const A = string(65) |
| assert(A == "A") |
| const E = string(-1) |
| assert(E == "\uFFFD") |
| assert(E == string(1234567890)) |
| |
| type myint int |
| assert(A == string(myint(65))) |
| |
| type mystring string |
| const _ mystring = mystring("foo") |
| |
| const _ = string /* ERROR "cannot convert" */ (true) |
| const _ = string /* ERROR "cannot convert" */ (1.2) |
| const _ = string /* ERROR "cannot convert" */ (nil) |
| } |
| |
| // |
| var ( |
| _ = int8(0) |
| ) |