const foo = []int{1,2}
x.go:3: expression must be a constant
instead of
x.go:3: fatal error: gettype: addtop
R=ken
OCL=30767
CL=30767
constiter(Node *vv, Type *t, Node *cc)
{
Iter viter, citer;
- Node *v, *c;
+ Node *v, *c, n1;
if(cc == N) {
if(t != T)
return;
}
- gettype(c, N);
+ memset(&n1, 0, sizeof n1);
+ gettype(c, &n1);
+ if(n1.ninit != nil) {
+ // the expression had extra code to run.
+ // dodclconst is going to print an error
+ // because the expression isn't constant,
+ // but out of paranoia, bump nerrors so
+ // that compile cannot succeed accidentally
+ nerrors++;
+ }
if(t != T)
convlit(c, t);
if(t == T)