mirror of
https://github.com/golang/go
synced 2024-11-21 20:14:52 -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");
|
yyerror("const initializer must be constant");
|
||||||
goto ret;
|
goto ret;
|
||||||
}
|
}
|
||||||
|
if(isconst(e, CTNIL)) {
|
||||||
|
yyerror("const initializer cannot be nil");
|
||||||
|
goto ret;
|
||||||
|
}
|
||||||
t = n->type;
|
t = n->type;
|
||||||
if(t != T) {
|
if(t != T) {
|
||||||
convlit(&e, t);
|
convlit(&e, t);
|
||||||
|
@ -77,3 +77,5 @@ func main() {
|
|||||||
f(String) // ERROR "convert|wrong type|cannot|incompatible"
|
f(String) // ERROR "convert|wrong type|cannot|incompatible"
|
||||||
f(Bool) // 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