Source file test/fixedbugs/issue26120.go

     1  // compile
     2  
     3  // Copyright 2018 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  // Issue 26120: INDEX of 1-element but non-SSAable array
     8  // is mishandled when building SSA.
     9  
    10  package p
    11  
    12  type T [1]struct {
    13  	f    []int
    14  	i, j int
    15  }
    16  
    17  func F() {
    18  	var v T
    19  	f := func() T {
    20  		return v
    21  	}
    22  	_ = []int{}[f()[0].i]
    23  }
    24  

View as plain text