summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-01-18 18:26:10 -0800
committerRuss Cox <rsc@golang.org>2010-01-18 18:26:10 -0800
commitfa64647970719d6b674c3e3dbd796650ac75d07e (patch)
tree1386e04a36865ca1e1d2cd0d95ff61b3a8f3bd1d /test
parentdef5c2f94502610ca0ba2677dee712e2c96f03ec (diff)
downloadgolang-fa64647970719d6b674c3e3dbd796650ac75d07e.tar.gz
add bug246 (issue 492)
R=r CC=golang-dev http://codereview.appspot.com/186216
Diffstat (limited to 'test')
-rw-r--r--test/bugs/bug246.go18
-rw-r--r--test/golden.out5
2 files changed, 23 insertions, 0 deletions
diff --git a/test/bugs/bug246.go b/test/bugs/bug246.go
new file mode 100644
index 000000000..e46cdfd04
--- /dev/null
+++ b/test/bugs/bug246.go
@@ -0,0 +1,18 @@
+// $G $D/$F.go || echo BUG: bug246
+
+// Copyright 2009 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 main
+
+import "unsafe"
+
+func main() {
+ // works
+ addr := uintptr(0)
+ _ = (*int)(unsafe.Pointer(addr))
+
+ // fails
+ _ = (*int)(unsafe.Pointer(uintptr(0)))
+}
diff --git a/test/golden.out b/test/golden.out
index 051bb9bc7..906ecac2b 100644
--- a/test/golden.out
+++ b/test/golden.out
@@ -149,3 +149,8 @@ panic PC=xxx
bad map check 13 false false
panic PC=xxx
BUG: tuple evaluation order
+
+=========== bugs/bug246.go
+bugs/bug246.go:17: cannot convert 0 to type unsafe.Pointer
+bugs/bug246.go:17: cannot convert 0 (type uintptr) to type *int in conversion
+BUG: bug246