2015-04-14 12:03:21 +02:00
|
|
|
package main
|
|
|
|
|
|
2015-07-15 11:31:30 +12:00
|
|
|
import (
|
2016-10-26 15:57:58 +13:00
|
|
|
"os"
|
|
|
|
|
"reflect"
|
2015-07-15 11:31:30 +12:00
|
|
|
"runtime"
|
2019-03-21 13:30:25 +01:00
|
|
|
|
|
|
|
|
"testshared/depBase"
|
2015-07-15 11:31:30 +12:00
|
|
|
)
|
2015-04-14 12:03:21 +02:00
|
|
|
|
2016-12-09 08:49:23 +13:00
|
|
|
// Having a function declared in the main package triggered
|
|
|
|
|
// golang.org/issue/18250
|
|
|
|
|
func DeclaredInMain() {
|
|
|
|
|
}
|
|
|
|
|
|
2016-12-12 13:31:56 +13:00
|
|
|
type C struct {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func F() *C {
|
|
|
|
|
return nil
|
|
|
|
|
}
|
|
|
|
|
|
2017-01-24 20:19:36 -08:00
|
|
|
var slicePtr interface{} = &[]int{}
|
|
|
|
|
|
2015-04-14 12:03:21 +02:00
|
|
|
func main() {
|
2016-05-04 11:23:24 +12:00
|
|
|
defer depBase.ImplementedInAsm()
|
2016-10-26 15:57:58 +13:00
|
|
|
// This code below causes various go.itab.* symbols to be generated in
|
|
|
|
|
// the executable. Similar code in ../depBase/dep.go results in
|
2017-11-03 05:48:43 +00:00
|
|
|
// exercising https://golang.org/issues/17594
|
2016-10-26 15:57:58 +13:00
|
|
|
reflect.TypeOf(os.Stdout).Elem()
|
2015-07-15 11:31:30 +12:00
|
|
|
runtime.GC()
|
2016-05-04 11:23:24 +12:00
|
|
|
depBase.V = depBase.F() + 1
|
2016-12-12 13:31:56 +13:00
|
|
|
|
|
|
|
|
var c *C
|
|
|
|
|
if reflect.TypeOf(F).Out(0) != reflect.TypeOf(c) {
|
|
|
|
|
panic("bad reflection results, see golang.org/issue/18252")
|
|
|
|
|
}
|
2017-01-24 20:19:36 -08:00
|
|
|
|
|
|
|
|
sp := reflect.New(reflect.TypeOf(slicePtr).Elem())
|
|
|
|
|
s := sp.Interface()
|
|
|
|
|
|
|
|
|
|
if reflect.TypeOf(s) != reflect.TypeOf(slicePtr) {
|
|
|
|
|
panic("bad reflection results, see golang.org/issue/18729")
|
|
|
|
|
}
|
2015-04-14 12:03:21 +02:00
|
|
|
}
|