From: Bryan C. Mills Date: Wed, 13 Sep 2017 21:21:07 +0000 (-0400) Subject: misc/cgo/errors: test that the Go rune type is not identical to C.int X-Git-Tag: go1.10beta1~1105 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=107744e94c4e62272962eba9195bc14a7eb69a09;p=gostls13.git misc/cgo/errors: test that the Go rune type is not identical to C.int rune has a well-defined size, but C.int is implementation-specified. Using one as the other should require an explicit conversion. updates #13467 Change-Id: I53ab2478427dca790efdcc197f6b8d9fbfbd1847 Reviewed-on: https://go-review.googlesource.com/63730 Reviewed-by: Ian Lance Taylor --- diff --git a/misc/cgo/errors/errors_test.go b/misc/cgo/errors/errors_test.go index e2b91063a6..d2e833c52c 100644 --- a/misc/cgo/errors/errors_test.go +++ b/misc/cgo/errors/errors_test.go @@ -114,6 +114,7 @@ func TestReportsTypeErrors(t *testing.T) { "issue11097b.go", "issue13129.go", "issue13423.go", + "issue13467.go", "issue13635.go", "issue13830.go", "issue16116.go", diff --git a/misc/cgo/errors/src/issue13467.go b/misc/cgo/errors/src/issue13467.go new file mode 100644 index 0000000000..e061880dda --- /dev/null +++ b/misc/cgo/errors/src/issue13467.go @@ -0,0 +1,15 @@ +// Copyright 2017 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 p + +/* +static int transform(int x) { return x; } +*/ +import "C" + +func F() { + var x rune = '✈' + var _ rune = C.transform(x) // ERROR HERE: C\.int +}