]> Cypherpunks repositories - gostls13.git/commitdiff
gc: bug301
authorRuss Cox <rsc@golang.org>
Tue, 3 Aug 2010 08:07:40 +0000 (01:07 -0700)
committerRuss Cox <rsc@golang.org>
Tue, 3 Aug 2010 08:07:40 +0000 (01:07 -0700)
Fixes #990.

R=ken2
CC=golang-dev
https://golang.org/cl/1742055

src/cmd/gc/typecheck.c
test/fixedbugs/bug301.go [new file with mode: 0644]

index 1910aa6f90c374b207558d924b2a2c4a062cb3cf..2eb6cc87d18c4b401168257b341d68e5896709b3 100644 (file)
@@ -1056,7 +1056,7 @@ reswitch:
                if(onearg(n, "panic") < 0)
                        goto error;
                typecheck(&n->left, Erv);
-               defaultlit(&n->left, T);
+               defaultlit(&n->left, types[TINTER]);
                if(n->left->type == T)
                        goto error;
                goto ret;
diff --git a/test/fixedbugs/bug301.go b/test/fixedbugs/bug301.go
new file mode 100644 (file)
index 0000000..a58f4e1
--- /dev/null
@@ -0,0 +1,18 @@
+// $G $D/$F.go || echo BUG: bug301.go
+
+// Copyright 2010 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.
+
+// http://code.google.com/p/go/issues/detail?id=990
+
+package main
+
+func main() {
+       defer func() {
+               if recover() != nil {
+                       panic("non-nil recover")
+               }
+       }()
+       panic(nil)
+}