Source file test/fixedbugs/issue39541.go

     1  // run
     2  
     3  // Copyright 2020 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  package main
     8  
     9  import "reflect"
    10  
    11  func sub(args []reflect.Value) []reflect.Value {
    12  	type A struct {
    13  		s int
    14  		t int
    15  	}
    16  	return []reflect.Value{reflect.ValueOf(A{1, 2})}
    17  }
    18  
    19  func main() {
    20  	f := reflect.MakeFunc(reflect.TypeOf((func() interface{})(nil)), sub).Interface().(func() interface{})
    21  	c := make(chan bool, 100)
    22  	for i := 0; i < 100; i++ {
    23  		go func() {
    24  			for j := 0; j < 10000; j++ {
    25  				f()
    26  			}
    27  			c <- true
    28  		}()
    29  	}
    30  	for i := 0; i < 100; i++ {
    31  		<-c
    32  	}
    33  }
    34  

View as plain text