Commit 0acb6376 authored by Russ Cox's avatar Russ Cox

gc: const nil bug

Fixes #1073.

R=ken2
CC=golang-dev
https://golang.org/cl/2169043
parent fa0c53da
......@@ -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"
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