Rémy Oudompheng | 2ece2f5 | 2012-02-18 22:15:42 +0100 | [diff] [blame] | 1 | // run |
Russ Cox | 7472f4c | 2009-07-09 12:08:50 -0700 | [diff] [blame] | 2 | |
| 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. |
| 6 | |
| 7 | package main |
| 8 | |
Russ Cox | 00f9f0c | 2010-03-30 10:34:57 -0700 | [diff] [blame] | 9 | var g byte = 123 |
| 10 | var f *byte = &g |
| 11 | var b = make([]byte, 5) |
Russ Cox | 7472f4c | 2009-07-09 12:08:50 -0700 | [diff] [blame] | 12 | |
| 13 | func main() { |
Russ Cox | 00f9f0c | 2010-03-30 10:34:57 -0700 | [diff] [blame] | 14 | b[0:1][0] = *f |
Russ Cox | 7472f4c | 2009-07-09 12:08:50 -0700 | [diff] [blame] | 15 | if b[0] != 123 { |
Russ Cox | 00f9f0c | 2010-03-30 10:34:57 -0700 | [diff] [blame] | 16 | println("want 123 got", b[0]) |
| 17 | panic("fail") |
| 18 | } |
Russ Cox | 7472f4c | 2009-07-09 12:08:50 -0700 | [diff] [blame] | 19 | } |