Eindir = 1<<8, // indirecting through expression
Eaddr = 1<<9, // taking address of expression
Eproc = 1<<10, // inside a go statement
+ Ecomplit = 1<<11, // type in composite literal
};
#define BITS 5
t->bound = -1; // slice
} else if(l->op == ODDD) {
t->bound = -100; // to be filled in
+ if(!(top&Ecomplit))
+ yyerror("use of [...] array outside of array literal");
} else {
l = typecheck(&n->left, Erv);
switch(consttype(l)) {
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);
}
}
setlineno(n->right);
- l = typecheck(&n->right /* sic */, Etype);
+ l = typecheck(&n->right /* sic */, Etype|Ecomplit);
if((t = l->type) == T)
goto error;
nerr = nerrors;
l->right->right = typenod(pushtype);
typecheck(&l->right, Erv);
defaultlit(&l->right, t->type);
- l->right = assignconv(l->right, t->type, "array index");
+ l->right = assignconv(l->right, t->type, "array element");
}
if(t->bound == -100)
t->bound = len;
_ = unsafe.Pointer(&x...) // ERROR "[.][.][.]"
_ = unsafe.Sizeof(x...) // ERROR "[.][.][.]"
_ = [...]byte("foo") // ERROR "[.][.][.]"
+ _ = [...][...]int{{1,2,3},{4,5,6}} // ERROR "[.][.][.]"
}
+