diff options
author | Russ Cox <rsc@golang.org> | 2013-09-09 12:49:39 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2013-09-09 12:49:39 -0400 |
commit | 7669896d90be8f3fe18c8347f2a196ebc0f36e4c (patch) | |
tree | 74180d6ecfb466ff7793db2a21a869683b90f81e /src/cmd/gc/subr.c | |
parent | a95a02ea7bcce95eaba10a93a794b8f1abb65816 (diff) | |
download | go-7669896d90be8f3fe18c8347f2a196ebc0f36e4c.tar.gz |
cmd/gc: diagnose '_ = nil' better
Fixes issue 6004.
R=ken2
CC=golang-dev
https://codereview.appspot.com/13616044
Diffstat (limited to 'src/cmd/gc/subr.c')
-rw-r--r-- | src/cmd/gc/subr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c index 2f617ac9d..079ca305d 100644 --- a/src/cmd/gc/subr.c +++ b/src/cmd/gc/subr.c @@ -1411,6 +1411,9 @@ assignconv(Node *n, Type *t, char *context) if(n == N || n->type == T || n->type->broke) return n; + if(t->etype == TBLANK && n->type->etype == TNIL) + yyerror("use of untyped nil"); + old = n; old->diag++; // silence errors about n; we'll issue one below defaultlit(&n, t); |