github.com/riscv/riscv-go@v0.0.0-20200123204226-124ebd6fcc8e/misc/cgo/test/issue18126.go (about)

     1  // Copyright 2016 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Issue 18126: cgo check of void function returning errno.
     6  
     7  package cgotest
     8  
     9  /*
    10  #include <stdlib.h>
    11  
    12  void Issue18126C(void **p) {
    13  }
    14  */
    15  import "C"
    16  
    17  import (
    18  	"testing"
    19  )
    20  
    21  func test18126(t *testing.T) {
    22  	p := C.malloc(1)
    23  	_, err := C.Issue18126C(&p)
    24  	C.free(p)
    25  	_ = err
    26  }