Source file src/cmd/vet/testdata/cgo/cgo.go

     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  }
    19  

View as plain text