aboutsummaryrefslogtreecommitdiff
path: root/misc/cgo/errors
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2018-12-03 10:53:10 -0800
committerIan Lance Taylor <iant@golang.org>2018-12-03 20:26:04 +0000
commit54cbc5b4bf554742b7037308bd45da010340628d (patch)
treea67458f9eb2edc4ae0cebe0bb3b3fa156fdbb052 /misc/cgo/errors
parentf98081e51585ebb6c321ee2145b1e38312759ea3 (diff)
downloadgo-54cbc5b4bf554742b7037308bd45da010340628d.tar.xz
cmd/cgo: use a plausible position for typedef error messages
Fixes #28069 Change-Id: I7e0f96b8b6d123de283325fcb78ec76455050f6d Reviewed-on: https://go-review.googlesource.com/c/152158 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'misc/cgo/errors')
-rw-r--r--misc/cgo/errors/errors_test.go7
-rw-r--r--misc/cgo/errors/src/issue28069.go26
2 files changed, 32 insertions, 1 deletions
diff --git a/misc/cgo/errors/errors_test.go b/misc/cgo/errors/errors_test.go
index 118187f23b..0d7ca4cf9d 100644
--- a/misc/cgo/errors/errors_test.go
+++ b/misc/cgo/errors/errors_test.go
@@ -126,7 +126,12 @@ func TestReportsTypeErrors(t *testing.T) {
}
if sizeofLongDouble(t) > 8 {
- check(t, "err4.go")
+ for _, file := range []string{
+ "err4.go",
+ "issue28069.go",
+ } {
+ check(t, file)
+ }
}
}
diff --git a/misc/cgo/errors/src/issue28069.go b/misc/cgo/errors/src/issue28069.go
new file mode 100644
index 0000000000..e19a3b45bd
--- /dev/null
+++ b/misc/cgo/errors/src/issue28069.go
@@ -0,0 +1,26 @@
+// 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.
+
+// Test that the error message for an unrepresentable typedef in a
+// union appears on the right line. This test is only run if the size
+// of long double is larger than 64.
+
+package main
+
+/*
+typedef long double Float128;
+
+typedef struct SV {
+ union {
+ Float128 float128;
+ } value;
+} SV;
+*/
+import "C"
+
+type ts struct {
+ tv *C.SV // ERROR HERE
+}
+
+func main() {}