Commit d3d0c256 authored by Russ Cox's avatar Russ Cox

bug123

R=ken
OCL=25075
CL=25075
parent aa35aee0
......@@ -1233,6 +1233,9 @@ lexinit(void)
s->otype = t;
}
/* for walk to use in error messages */
types[TFUNC] = functype(N, N, N);
/* pick up the backend typedefs */
belexinit(LBASETYPE);
......
......@@ -373,9 +373,12 @@ loop:
if(n->type != T)
goto ret;
walktype(n->left, Erv);
if(n->left == N)
goto ret;
walktype(n->left, Erv);
convlit(n->left, types[TFUNC]);
t = n->left->type;
if(t == T)
goto ret;
......@@ -472,6 +475,7 @@ loop:
if(cr == 1) {
// a,b,... = fn()
walktype(r, Erv);
convlit(r, types[TFUNC]);
l = ascompatet(n->op, &n->left, &r->type, 0);
if(l != N)
indir(n, list(r, reorder2(l)));
......@@ -3108,6 +3112,7 @@ multi:
case OCALLINTER:
case OCALL:
walktype(nr->left, Erv);
convlit(nr->left, types[TFUNC]);
t = nr->left->type;
if(t != T && t->etype == tptr)
t = t->type;
......
......@@ -7,7 +7,7 @@
package main
const ( F = 1 )
func fn(i int) int {
if i == F() { // ERROR "function"
if i == F() { // ERROR "func"
return 0
}
return 1
......
......@@ -143,9 +143,6 @@ BUG: should compile
=========== bugs/bug122.go
BUG: compilation succeeds incorrectly
=========== bugs/bug123.go
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug123.go
=========== bugs/bug125.go
BUG: errchk: command succeeded unexpectedly: 6g bugs/bug125.go
......
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