cgo.go 462 B

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