summaryrefslogtreecommitdiff
path: root/test/fixedbugs/issue4879.dir
diff options
context:
space:
mode:
authorR?my Oudompheng <oudomphe@phare.normalesup.org>2013-02-26 00:43:31 +0100
committerR?my Oudompheng <oudomphe@phare.normalesup.org>2013-02-26 00:43:31 +0100
commitd3668771286a97e056f402c39a47f577810b9a6c (patch)
tree4116946bd284bb54d9b8a0f307c516b44019402f /test/fixedbugs/issue4879.dir
parente655e97ad31ebb98f05cf12f7eccdfda9a0c438a (diff)
downloadgo-d3668771286a97e056f402c39a47f577810b9a6c.tar.gz
cmd/gc: fix corruption in export of &T{} literals.
Composite literals using the &T{} form were incorrectly exported, leading to weird errors at import time. Fixes issue 4879. R=golang-dev, rsc CC=golang-dev https://codereview.appspot.com/7395054
Diffstat (limited to 'test/fixedbugs/issue4879.dir')
-rw-r--r--test/fixedbugs/issue4879.dir/a.go33
-rw-r--r--test/fixedbugs/issue4879.dir/b.go9
2 files changed, 42 insertions, 0 deletions
diff --git a/test/fixedbugs/issue4879.dir/a.go b/test/fixedbugs/issue4879.dir/a.go
new file mode 100644
index 000000000..7ee7c4860
--- /dev/null
+++ b/test/fixedbugs/issue4879.dir/a.go
@@ -0,0 +1,33 @@
+package a
+
+import (
+ "unsafe"
+)
+
+type Collection struct {
+ root unsafe.Pointer
+}
+
+type nodeLoc struct{}
+
+type slice []int
+
+type maptype map[int]int
+
+func MakePrivateCollection() *Collection {
+ return &Collection{
+ root: unsafe.Pointer(&nodeLoc{}),
+ }
+}
+
+func MakePrivateCollection2() *Collection {
+ return &Collection{
+ root: unsafe.Pointer(&slice{}),
+ }
+}
+func MakePrivateCollection3() *Collection {
+ return &Collection{
+ root: unsafe.Pointer(&maptype{}),
+ }
+}
+
diff --git a/test/fixedbugs/issue4879.dir/b.go b/test/fixedbugs/issue4879.dir/b.go
new file mode 100644
index 000000000..d8fb5693d
--- /dev/null
+++ b/test/fixedbugs/issue4879.dir/b.go
@@ -0,0 +1,9 @@
+package b
+
+import "./a"
+
+func F() {
+ a.MakePrivateCollection()
+ a.MakePrivateCollection2()
+ a.MakePrivateCollection3()
+}