From 84953bdaa8e444952e4ef6ab7cf96c95e25d42dc Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Tue, 6 Jan 2009 15:39:28 -0800 Subject: [PATCH] fix newfn R=ken OCL=22173 CL=22173 --- src/cmd/gc/walk.c | 3 ++- test/newfn.go | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 6c7c02838c7..870d30a98af 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -2078,13 +2078,14 @@ Node* newcompat(Node *n) { Node *r, *on; - Type *t, *t0; + Type *t; t = n->type; if(t == T) goto bad; switch(t->etype) { + case TFUNC: case TSTRING: case TMAP: case TCHAN: diff --git a/test/newfn.go b/test/newfn.go index fbbf942ce4e..63df683ce6d 100644 --- a/test/newfn.go +++ b/test/newfn.go @@ -10,5 +10,8 @@ func main() { f := new(()); // ERROR "new" g := new((x int, f float) string); // ERROR "new" - h := new(()); // ok + h := new(*()); // ok + i := new(string); // ok + j := new(map[int]int); // ok + k := new(chan int); // ok }