Source file test/fixedbugs/issue31412a.go

     1  // compile
     2  
     3  // Copyright 2019 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  // This code was incorrectly flagged as erroneous by gccgo.
     8  
     9  package main
    10  
    11  type Name string
    12  
    13  type EFunc func(int) int
    14  
    15  func Register(f EFunc, names ...Name) int {
    16  	return f(len(names))
    17  }
    18  
    19  const (
    20  	B Name = "B"
    21  )
    22  
    23  func RegisterIt() {
    24  	n := B + "Duck"
    25  	d := B + "Goose"
    26  	f := func(x int) int { return x + 9 }
    27  	Register(f, n, d)
    28  }
    29  
    30  func main() {
    31  	RegisterIt()
    32  }
    33  

View as plain text