2016-10-30 21:53:09 -06:00
|
|
|
// Copyright 2016 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.
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
2016-12-10 11:30:13 -07:00
|
|
|
//#include <errno.h>
|
|
|
|
//#include <string.h>
|
2016-10-30 21:53:09 -06:00
|
|
|
import "C"
|
|
|
|
|
2016-12-10 11:30:13 -07:00
|
|
|
// #include
|
|
|
|
// void cfunc() {} // uses cgo_topofstack
|
|
|
|
|
|
|
|
import (
|
2017-09-01 09:20:33 -06:00
|
|
|
"reflect"
|
2016-12-10 11:30:13 -07:00
|
|
|
"strings"
|
2019-03-21 06:30:25 -06:00
|
|
|
|
|
|
|
"testplugin/common"
|
2016-12-10 11:30:13 -07:00
|
|
|
)
|
2016-10-30 21:53:09 -06:00
|
|
|
|
|
|
|
func init() {
|
2016-12-10 11:30:13 -07:00
|
|
|
_ = strings.NewReplacer() // trigger stack unwind, Issue #18190.
|
|
|
|
C.strerror(C.EIO) // uses cgo_topofstack
|
2016-10-30 21:53:09 -06:00
|
|
|
common.X = 2
|
|
|
|
}
|
|
|
|
|
2017-09-01 09:20:33 -06:00
|
|
|
type sameNameReusedInPlugins struct {
|
|
|
|
X string
|
|
|
|
}
|
|
|
|
|
|
|
|
type sameNameHolder struct {
|
|
|
|
F *sameNameReusedInPlugins
|
|
|
|
}
|
|
|
|
|
|
|
|
func UnexportedNameReuse() {
|
|
|
|
h := sameNameHolder{}
|
|
|
|
v := reflect.ValueOf(&h).Elem().Field(0)
|
|
|
|
newval := reflect.New(v.Type().Elem())
|
|
|
|
v.Set(newval)
|
|
|
|
}
|
|
|
|
|
2016-10-30 21:53:09 -06:00
|
|
|
func main() {
|
|
|
|
panic("plugin1.main called")
|
|
|
|
}
|