Debian Codegraph @

test/fixedbugs/issue26335.go

raw
1 // run
2
3 // Copyright 2018 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 mishandled passing a struct with an empty field through
8 // reflect.Value.Call.
9
10 package main
11
12 import (
13 "reflect"
14 )
15
16 type Empty struct {
17 f1, f2 *byte
18 empty struct{}
19 }
20
21 func F(e Empty, s []string) {
22 if len(s) != 1 || s[0] != "hi" {
23 panic("bad slice")
24 }
25 }
26
27 func main() {
28 reflect.ValueOf(F).Call([]reflect.Value{
29 reflect.ValueOf(Empty{}),
30 reflect.ValueOf([]string{"hi"}),
31 })
32 }