From d3668771286a97e056f402c39a47f577810b9a6c Mon Sep 17 00:00:00 2001 From: R?my Oudompheng Date: Tue, 26 Feb 2013 00:43:31 +0100 Subject: 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 --- test/fixedbugs/issue4879.dir/a.go | 33 +++++++++++++++++++++++++++++++++ test/fixedbugs/issue4879.dir/b.go | 9 +++++++++ 2 files changed, 42 insertions(+) create mode 100644 test/fixedbugs/issue4879.dir/a.go create mode 100644 test/fixedbugs/issue4879.dir/b.go (limited to 'test/fixedbugs/issue4879.dir') 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() +} -- cgit v1.2.1