test/fixedbugs/issue8961.go
raw| 1 | // run |
| 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 8961. Empty composite literals to small globals were not filled in |
| 8 | package main |
| 9 | |
| 10 | type small struct { a int } |
| 11 | var foo small |
| 12 | |
| 13 | func main() { |
| 14 | foo.a = 1 |
| 15 | foo = small{} |
| 16 | if foo.a != 0 { |
| 17 | println("expected foo.a to be 0, was", foo.a) |
| 18 | panic("composite literal not filled in") |
| 19 | } |
| 20 | } |