github.com/gagliardetto/golang-go@v0.0.0-20201020153340-53909ea70814/cmd/vet/testdata/cgo/cgo.go (about)

     1  // Copyright 2015 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  // This file contains tests for the cgo checker.
     6  
     7  package testdata
     8  
     9  // void f(void *p) {}
    10  import "C"
    11  
    12  import "unsafe"
    13  
    14  func CgoTests() {
    15  	var c chan bool
    16  	C.f(*(*unsafe.Pointer)(unsafe.Pointer(&c))) // ERROR "embedded pointer"
    17  	C.f(unsafe.Pointer(&c))                     // ERROR "embedded pointer"
    18  }