summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorHiroshi Ioka <hirochachacha@gmail.com>2018-01-06 18:10:30 +0900
committerIan Lance Taylor <iant@golang.org>2018-06-18 18:28:02 +0000
commit741dad28cb50b7cdbd4b6fd46114541aa73b15be (patch)
tree6eb27ca63248bf1cfb0fb42bd1cb44fb970310e0 /misc
parentb7d9e6e149567bb94d6bb87a9ab09c60055ac4e8 (diff)
downloadgo-git-741dad28cb50b7cdbd4b6fd46114541aa73b15be.tar.gz
cmd/cgo: avoid name confliction for C functions
Use more cryptic names for local variables inside C function wrappers. Fixes #23356 Change-Id: Ia6a0218f27a13be14f589b1a0facc9683d22ff56 Reviewed-on: https://go-review.googlesource.com/86495 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'misc')
-rw-r--r--misc/cgo/test/cgo_test.go1
-rw-r--r--misc/cgo/test/issue23356.go19
2 files changed, 20 insertions, 0 deletions
diff --git a/misc/cgo/test/cgo_test.go b/misc/cgo/test/cgo_test.go
index 4462df0059..4c7f676e0b 100644
--- a/misc/cgo/test/cgo_test.go
+++ b/misc/cgo/test/cgo_test.go
@@ -89,6 +89,7 @@ func Test21897(t *testing.T) { test21897(t) }
func Test22906(t *testing.T) { test22906(t) }
func Test24206(t *testing.T) { test24206(t) }
func Test25143(t *testing.T) { test25143(t) }
+func Test23356(t *testing.T) { test23356(t) }
func BenchmarkCgoCall(b *testing.B) { benchCgoCall(b) }
func BenchmarkGoString(b *testing.B) { benchGoString(b) }
diff --git a/misc/cgo/test/issue23356.go b/misc/cgo/test/issue23356.go
new file mode 100644
index 0000000000..1c390120c8
--- /dev/null
+++ b/misc/cgo/test/issue23356.go
@@ -0,0 +1,19 @@
+// Copyright 2018 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.
+
+package cgotest
+
+// int a(void) { return 5; };
+// int r(void) { return 3; };
+import "C"
+import "testing"
+
+func test23356(t *testing.T) {
+ if got, want := C.a(), C.int(5); got != want {
+ t.Errorf("C.a() == %v, expected %v", got, want)
+ }
+ if got, want := C.r(), C.int(3); got != want {
+ t.Errorf("C.r() == %v, expected %v", got, want)
+ }
+}