]> Cypherpunks repositories - gostls13.git/commitdiff
gc: const debug bool = false
authorRuss Cox <rsc@golang.org>
Tue, 19 Jan 2010 23:25:44 +0000 (15:25 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 19 Jan 2010 23:25:44 +0000 (15:25 -0800)
R=ken2
CC=golang-dev
https://golang.org/cl/186232

src/cmd/gc/walk.c
test/fixedbugs/bug238.go

index 211efaec94ac0d6b42f00373462d78a4424aff95..acccbec2c912ffa4c53f3ef0763461b787c0a504 100644 (file)
@@ -182,7 +182,7 @@ walkdef(Node *n)
                t = n->type;
                if(t != T) {
                        convlit(&e, t);
-                       if(!isint[t->etype] && !isfloat[t->etype] && t->etype != TSTRING)
+                       if(!isint[t->etype] && !isfloat[t->etype] && t->etype != TSTRING && t->etype != TBOOL)
                                yyerror("invalid constant type %T", t);
                }
                n->val = e->val;
index 3ceacf51d7ff8400d946c32b368bcaa8110e7993..83054fbc0c1badbf97058b44766567176e1e1322 100644 (file)
@@ -15,5 +15,8 @@ const d chan int = 4    // ERROR "convert|wrong|incompatible"
 const e func() = 5      // ERROR "convert|wrong|incompatible"
 const f struct{} = 6    // ERROR "convert|wrong|incompatible"
 const g interface{} = 7 // ERROR "constant|wrong|incompatible"
+const h bool = false
+const i int = 2
+const j float = 5
 
 func main() { println(a, b, c, d, e, f, g) }