github.com/huandu/go@v0.0.0-20151114150818-04e615e41150/misc/cgo/test/issue7665.go (about) 1 // Copyright 2013 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 package cgotest 6 7 import ( 8 "testing" 9 "unsafe" 10 ) 11 12 // extern void f7665(void); 13 import "C" 14 15 //export f7665 16 func f7665() {} 17 18 var bad7665 unsafe.Pointer = C.f7665 19 var good7665 uintptr = uintptr(C.f7665) 20 21 func test7665(t *testing.T) { 22 if bad7665 == nil || bad7665 != unsafe.Pointer(good7665) { 23 t.Errorf("ptrs = %p, %#x, want same non-nil pointer", bad7665, good7665) 24 } 25 }