Source file test/fixedbugs/issue66261.go

     1  // run
     2  
     3  // Copyright 2024 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  func main() {
    10  	env := func() func(*bool) func() int {
    11  		return func() func(*bool) func() int {
    12  			return func(ptr *bool) func() int {
    13  				return func() int {
    14  					*ptr = true
    15  					return 0
    16  				}
    17  			}
    18  		}()
    19  	}()
    20  
    21  	var ok bool
    22  	func(int) {}(env(&ok)())
    23  	if !ok {
    24  		panic("FAIL")
    25  	}
    26  }
    27  

View as plain text