Source file test/fixedbugs/issue22683.go

     1  // run
     2  
     3  // Copyright 2017 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 (
    10  	"fmt"
    11  )
    12  
    13  type foo struct {
    14  	bar [1]*int
    15  }
    16  
    17  func main() {
    18  	ch := make(chan foo, 2)
    19  	var a int
    20  	var b [1]*int
    21  	b[0] = &a
    22  	ch <- foo{bar: b}
    23  	close(ch)
    24  
    25  	for v := range ch {
    26  		for i := 0; i < 1; i++ {
    27  			fmt.Println(v.bar[0] != nil)
    28  		}
    29  	}
    30  }
    31  

View as plain text