From b3f303ec9a577149727511d80d9c82ac119bf29d Mon Sep 17 00:00:00 2001 From: Ken Thompson Date: Wed, 27 May 2009 18:37:02 -0700 Subject: [PATCH] bug 153 R=r OCL=29479 CL=29479 --- src/cmd/gc/walk.c | 7 ++++++- test/{bugs => fixedbugs}/bug153.go | 0 test/golden.out | 4 ---- 3 files changed, 6 insertions(+), 5 deletions(-) rename test/{bugs => fixedbugs}/bug153.go (100%) diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 96cd4005412..60d5a9d022c 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -1945,8 +1945,13 @@ mkdotargs(Node *r, Node *rr, Iter *saver, Node *nn, Type *l, int fp) st = typ(TSTRUCT); // generated structure ft = T; // last field while(r != N) { + if(r->op == OLITERAL && r->val.ctype == CTNIL) { + if(r->type == T || r->type->etype == TNIL) { + yyerror("inappropriate use of nil in ... argument"); + return N; + } + } defaultlit(r, T); - if(r->type == T) // type check failed return N; diff --git a/test/bugs/bug153.go b/test/fixedbugs/bug153.go similarity index 100% rename from test/bugs/bug153.go rename to test/fixedbugs/bug153.go diff --git a/test/golden.out b/test/golden.out index 6a7756babb4..6bc8837d49c 100644 --- a/test/golden.out +++ b/test/golden.out @@ -108,10 +108,6 @@ BUG: should crash bugs/bug149.go:14: cannot convert []uint8 constant to string BUG: should compile -=========== bugs/bug153.go -BUG: errchk: bugs/bug153.go:9: error message does not match 'nil' -bugs/bug153.go:9: fatal error: dowidth: unknown type: E-34 - =========== fixedbugs/bug016.go fixedbugs/bug016.go:7: constant -3 overflows uint