modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue7867.go (about)

     1  // runoutput
     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  // Issue 7867.
     8  
     9  package main
    10  
    11  import "fmt"
    12  
    13  const tpl = `
    14  func Test%d(t %s) {
    15  	_ = t
    16  	_ = t
    17  }
    18  `
    19  
    20  func main() {
    21  	fmt.Println("package main")
    22  	types := []string{
    23  		// These types always passed
    24  		"bool", "int", "rune",
    25  		"*int", "uintptr",
    26  		"float32", "float64",
    27  		"chan struct{}",
    28  		"map[string]struct{}",
    29  		"func()", "func(string)error",
    30  
    31  		// These types caused compilation failures
    32  		"complex64", "complex128",
    33  		"struct{}", "struct{n int}", "struct{e error}", "struct{m map[string]string}",
    34  		"string",
    35  		"[4]byte",
    36  		"[]byte",
    37  		"interface{}", "error",
    38  	}
    39  	for i, typ := range types {
    40  		fmt.Printf(tpl, i, typ)
    41  	}
    42  	fmt.Println("func main() {}")
    43  }