History

detect [more] non-constant initialisers (cinap)

Charles Forsyth committed 10 years agomaster

Commit de2aa6c1 parent d3cbf781 file · +8 −1Browse files

Unified · Split

cc/dcl.c+8−1
@@ -381,8 +381,15 @@ init1(Sym *s, Type *t, long o, int exflag) · 380 unmodified lines
381381 diag(a, "initialization of incompatible pointers: %s\n%T and %T",
382382 s->name, t, a->type);
383383 }
384− if(a->op == OADDR)
384+ switch(a->op) {
385+ case OADDR:
385386 a = a->left;
387+ break;
388+ case ONAME:
389+ case OIND:
390+ diag(a, "initializer is not a constant: %s", s->name);
391+ return Z;
392+ }
386393 goto gext;
387394 }
388395