1 // Copyright 2021 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.
5 // Issue 42580: cmd/cgo: shifting identifier position in ast
9 // typedef int (*intFunc) ();
13 // int func_with_char(char* arg, void* dummy)
16 // int* get_arr(char* arg, void* dummy)
23 checkedPointer = []byte{1}
24 doublePointerChecked = []byte{1}
25 singleInnerPointerChecked = []byte{1}
28 // This test checks the positions of variable identifiers.
29 // Changing the positions of the test variables idents after this point will break the test.
31 func TestSingleArgumentCast() C.int {
32 retcode := C.func_with_char((*C.char)(unsafe.Pointer(&checkedPointer[0])), unsafe.Pointer(C.strarg))
36 func TestSingleArgumentCastRecFuncAsSimpleArg() C.int {
37 retcode := C.func_with_char((*C.char)(unsafe.Pointer(C.get_arr((*C.char)(unsafe.Pointer(&singleInnerPointerChecked[0])), unsafe.Pointer(C.strarg)))), nil)
41 func TestSingleArgumentCastRecFunc() C.int {
42 retcode := C.func_with_char((*C.char)(unsafe.Pointer(C.get_arr((*C.char)(unsafe.Pointer(&doublePointerChecked[0])), unsafe.Pointer(C.strarg)))), unsafe.Pointer(C.strarg))