1
0
mirror of https://github.com/golang/go synced 2024-11-18 01:24:49 -07:00
go/misc/cgo/errors/testdata/issue33061.go
Ian Lance Taylor e831719469 cmd/cgo: do not rewrite call if there are more args than parameters
We already skipped rewriting the call if there were fewer args than
parameters. But we can also get a cgo crash if there are more args,
if at least one of the extra args uses a name qualified with "C.".
Skip the rewrite, since the build will fail later anyhow.

Fixes #33061

Change-Id: I62ff3518b775b502ad10c2bacf9102db4c9a531c
Reviewed-on: https://go-review.googlesource.com/c/go/+/185797
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2019-07-12 17:31:29 +00:00

18 lines
373 B
Go

// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// cgo shouldn't crash if there is an extra argument with a C reference.
package main
// void F(void* p) {};
import "C"
import "unsafe"
func F() {
var i int
C.F(unsafe.Pointer(&i), C.int(0)) // ERROR HERE
}