blob: 7081b1cb3567f59103f649c970539a708c49e31b [file] [log] [blame]
Ian Lance Taylorbbb88f92015-12-21 14:38:25 -08001// run
2
3// Copyright 2015 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// Gccgo used to miscompile passing a global variable with a
8// zero-sized type to a function.
9
10package main
11
12type T struct {
13 field s
14}
15
16type s struct{}
17
18var X T
19
20func F(_ T, c interface{}) int {
21 return len(c.(string))
22}
23
24func main() {
25 if v := F(X, "hi"); v != 2 {
26 panic(v)
27 }
28}