bug182 - compiler crash

R=ken
OCL=32887
CL=32887
This commit is contained in:
Russ Cox 2009-08-07 13:17:28 -07:00
parent 6c2738eb43
commit 468f244416
2 changed files with 14 additions and 1 deletions

View File

@ -879,7 +879,7 @@ reswitch:
typechecklist(n->ninit, Etop);
typecheck(&n->ntest, Erv);
if(n->ntest != N && (t = n->ntest->type) != T && t->etype != TBOOL)
yyerror("non-bool %+N used as if condition");
yyerror("non-bool %+N used as if condition", n->ntest);
typechecklist(n->nbody, Etop);
typechecklist(n->nelse, Etop);
goto ret;

13
test/fixedbugs/bug182.go Normal file
View File

@ -0,0 +1,13 @@
// errchk $G $D/$F.go
// Copyright 2009 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.
package main
func main() {
x := 0;
if x { // ERROR "x.*int"
}
}