• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2016 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5package main
6
7//#include <errno.h>
8//#include <string.h>
9import "C"
10
11// #include
12// void cfunc() {} // uses cgo_topofstack
13
14import (
15	"reflect"
16	"strings"
17
18	"testplugin/common"
19)
20
21func init() {
22	_ = strings.NewReplacer() // trigger stack unwind, Issue #18190.
23	C.strerror(C.EIO)         // uses cgo_topofstack
24	common.X = 2
25}
26
27type sameNameReusedInPlugins struct {
28	X string
29}
30
31type sameNameHolder struct {
32	F *sameNameReusedInPlugins
33}
34
35func UnexportedNameReuse() {
36	h := sameNameHolder{}
37	v := reflect.ValueOf(&h).Elem().Field(0)
38	newval := reflect.New(v.Type().Elem())
39	v.Set(newval)
40}
41
42func main() {
43	panic("plugin1.main called")
44}
45