Source file test/fixedbugs/issue71226.go

     1  // build
     2  
     3  //go:build cgo
     4  
     5  // Copyright 2025 The Go Authors. All rights reserved.
     6  // Use of this source code is governed by a BSD-style
     7  // license that can be found in the LICENSE file.
     8  
     9  package main
    10  
    11  /*
    12  #cgo CFLAGS: -Werror -Wimplicit-function-declaration
    13  
    14  #include <stdio.h>
    15  
    16  static void CFn(_GoString_ gostr) {
    17  	printf("%.*s\n", (int)(_GoStringLen(gostr)), _GoStringPtr(gostr));
    18  }
    19  */
    20  import "C"
    21  
    22  func main() {
    23  	C.CFn("hello, world")
    24  }
    25  
    26  // The bug only occurs if there is an exported function.
    27  //export Fn
    28  func Fn() {
    29  }
    30  

View as plain text