2016-08-26 07:04:27 -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
|
|
|
|
|
|
|
|
// // No C code required.
|
|
|
|
import "C"
|
|
|
|
|
2017-09-01 09:20:33 -06:00
|
|
|
import (
|
|
|
|
"common"
|
|
|
|
"reflect"
|
|
|
|
)
|
2016-08-26 07:04:27 -06:00
|
|
|
|
2016-12-09 10:38:34 -07:00
|
|
|
func F() int {
|
|
|
|
_ = make([]byte, 1<<21) // trigger stack unwind, Issue #18190.
|
|
|
|
return 3
|
|
|
|
}
|
2016-10-30 13:31:21 -06:00
|
|
|
|
2016-08-26 07:04:27 -06:00
|
|
|
func ReadCommonX() int {
|
|
|
|
return common.X
|
|
|
|
}
|
|
|
|
|
|
|
|
var Seven int
|
|
|
|
|
2016-11-13 19:20:58 -07:00
|
|
|
func call(fn func()) {
|
|
|
|
fn()
|
|
|
|
}
|
|
|
|
|
|
|
|
func g() {
|
|
|
|
common.X *= Seven
|
|
|
|
}
|
|
|
|
|
2016-08-26 07:04:27 -06:00
|
|
|
func init() {
|
|
|
|
Seven = 7
|
2016-11-13 19:20:58 -07:00
|
|
|
call(g)
|
2016-08-26 07:04:27 -06:00
|
|
|
}
|
|
|
|
|
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-08-26 07:04:27 -06:00
|
|
|
func main() {
|
|
|
|
panic("plugin1.main called")
|
|
|
|
}
|