mirror of
https://github.com/golang/go
synced 2024-11-21 19:14:44 -07:00
gc: const nil bug
Fixes #1073. R=ken2 CC=golang-dev https://golang.org/cl/2169043
This commit is contained in:
parent
fa0c53da60
commit
0acb63769c
@ -261,6 +261,10 @@ walkdef(Node *n)
|
||||
yyerror("const initializer must be constant");
|
||||
goto ret;
|
||||
}
|
||||
if(isconst(e, CTNIL)) {
|
||||
yyerror("const initializer cannot be nil");
|
||||
goto ret;
|
||||
}
|
||||
t = n->type;
|
||||
if(t != T) {
|
||||
convlit(&e, t);
|
||||
|
@ -77,3 +77,5 @@ func main() {
|
||||
f(String) // ERROR "convert|wrong type|cannot|incompatible"
|
||||
f(Bool) // ERROR "convert|wrong type|cannot|incompatible"
|
||||
}
|
||||
|
||||
const ptr = nil // ERROR "const.*nil"
|
||||
|
Loading…
Reference in New Issue
Block a user