Source file test/fixedbugs/bug489.go

     1  // compile
     2  
     3  // Copyright 2014 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  // The gccgo compiler had a bug: mentioning a function type in an
     8  // expression in a function literal messed up the list of variables
     9  // referenced in enclosing functions.
    10  
    11  package main
    12  
    13  func main() {
    14  	v1, v2 := 0, 0
    15  	f := func() {
    16  		a := v1
    17  		g := (func())(nil)
    18  		b := v2
    19  		_, _, _ = a, g, b
    20  	}
    21  	_, _, _ = v1, v2, f
    22  }
    23  

View as plain text