| // Copyright 2009 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. |
| // Test various safe uses of indirection. |
| var m2 *map[string]int = &m0 |
| var m3 map[string]int = map[string]int{"a": 1} |
| var m4 *map[string]int = &m3 |
| var b3 []int = []int{1, 2, 3} |
| // these uses of nil pointers |
| // would crash but should type check |
| // this is spaced funny so that |
| // the compiler will print a different |
| // line number for each len call if |
| // it decides there are type errors. |
| // it might also help in the traceback. |
| println("wrong stringlen") |
| println("wrong arraylen") |
| println("wrong slicelen") |
| println("wrong slicecap") |
| func main() { nocrash() } |