Merge pull request #256 from alliedmodders/bug6302
Don't special case hierarchy-free enumeration constants when used as array indices. (bug 6302)
This commit is contained in:
commit
0bb2dc32af
@ -2227,7 +2227,11 @@ restart:
|
||||
* from the field and save the size of the field too.
|
||||
*/
|
||||
assert(lval2.sym==NULL || lval2.sym->dim.array.level==0);
|
||||
if (lval2.sym!=NULL && lval2.sym->dim.array.length>0 && sym->dim.array.level==0) {
|
||||
if (lval2.sym &&
|
||||
lval2.sym->parent &&
|
||||
lval2.sym->dim.array.length > 0 &&
|
||||
sym->dim.array.level==0)
|
||||
{
|
||||
lval1->tag=lval2.sym->x.tags.index;
|
||||
lval1->constval=lval2.sym->dim.array.length;
|
||||
} /* if */
|
||||
@ -2280,8 +2284,11 @@ restart:
|
||||
* from the field and save the size of the field too. Otherwise, the
|
||||
* tag is the one from the array symbol.
|
||||
*/
|
||||
if (lval2.ident==iCONSTEXPR && lval2.sym!=NULL
|
||||
&& lval2.sym->dim.array.length>0 && sym->dim.array.level==0)
|
||||
if (lval2.ident==iCONSTEXPR &&
|
||||
lval2.sym &&
|
||||
lval2.sym->parent &&
|
||||
lval2.sym->dim.array.length > 0 &&
|
||||
sym->dim.array.level == 0)
|
||||
{
|
||||
lval1->tag=lval2.sym->x.tags.index;
|
||||
lval1->constval=lval2.sym->dim.array.length;
|
||||
@ -2310,15 +2317,17 @@ restart:
|
||||
lval1->constval=0;
|
||||
} /* if */
|
||||
|
||||
/* a cell in an array is an lvalue, a character in an array is not
|
||||
* always a *valid* lvalue */
|
||||
lvalue = TRUE;
|
||||
|
||||
// If there's a call/fetch coming up, keep parsing.
|
||||
if (matchtoken('.')) {
|
||||
lexpush();
|
||||
goto restart;
|
||||
}
|
||||
|
||||
/* a cell in an array is an lvalue, a character in an array is not
|
||||
* always a *valid* lvalue */
|
||||
return TRUE;
|
||||
return lvalue;
|
||||
} else { /* tok=='(' -> function(...) */
|
||||
svalue thisval;
|
||||
thisval.val = *lval1;
|
||||
|
Loading…
Reference in New Issue
Block a user