]> Cypherpunks repositories - gostls13.git/commitdiff
missing error checking related to ([...]int){...}
authorRuss Cox <rsc@golang.org>
Wed, 30 Sep 2009 04:23:34 +0000 (21:23 -0700)
committerRuss Cox <rsc@golang.org>
Wed, 30 Sep 2009 04:23:34 +0000 (21:23 -0700)
R=ken
OCL=35132
CL=35132

src/cmd/gc/dcl.c
src/cmd/gc/typecheck.c

index 356314296cecad5bd292e1a1201cab02f93ad51b..bc8362d284ef890af56d5c7e744ba2fb2eb94bf8 100644 (file)
@@ -323,7 +323,7 @@ variter(NodeList *vl, Node *t, NodeList *el)
                declare(v, dclcontext);
                v->ntype = t;
 
-               if(e != N || funcdepth > 0) {
+               if(e != N || funcdepth > 0 || isblank(v)) {
                        if(funcdepth > 0)
                                init = list(init, nod(ODCL, v, N));
                        e = nod(OAS, v, e);
index a62202442467ba801129000945dbb9b7e1b9bc81..f1271408a839882bb9aaeb02d81172423a4a2cf2 100644 (file)
@@ -1010,6 +1010,11 @@ ret:
                case TNIL:
                case TBLANK:
                        break;
+               case TARRAY:
+                       if(t->bound == -100) {
+                               yyerror("use of [...] array outside of array literal");
+                               t->bound = 1;
+                       }
                default:
                        checkwidth(t);
                }