Commit 21b2e168 authored by Jan Ziak's avatar Jan Ziak

cmd/gc: fix spurious 'use of untyped nil' error

Fixes #6402

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/81340044
parent 6119dc1b
......@@ -1144,7 +1144,10 @@ defaultlit(Node **np, Type *t)
}
if(n->val.ctype == CTNIL) {
lineno = lno;
yyerror("use of untyped nil");
if(!n->diag) {
yyerror("use of untyped nil");
n->diag = 1;
}
n->type = T;
break;
}
......
// errorcheck
// Copyright 2014 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.
// Issue 6402: spurious 'use of untyped nil' error
package p
func f() uintptr {
return nil // ERROR "cannot use nil as type uintptr in return argument"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment