summaryrefslogtreecommitdiff
path: root/src/cmd/gc/subr.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-09-09 12:49:39 -0400
committerRuss Cox <rsc@golang.org>2013-09-09 12:49:39 -0400
commit7669896d90be8f3fe18c8347f2a196ebc0f36e4c (patch)
tree74180d6ecfb466ff7793db2a21a869683b90f81e /src/cmd/gc/subr.c
parenta95a02ea7bcce95eaba10a93a794b8f1abb65816 (diff)
downloadgo-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.c3
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);