Compiler: Fix enum field size was not taken into account when implicitly passed to a function.

Imported from Pawn 3.3.3930.

Example:

---

enum tag
{
  member[32]
}

new var[tag];

foo(const string[], size = sizeof(string))
{
    // size returns 1 before fix, 32, after.
}

public plugin_init()
{
    foo(var[member]);
}

---
This commit is contained in:
Arkshine 2014-08-17 13:56:51 +02:00
parent f60b00ee71
commit a873066466
2 changed files with 2 additions and 2 deletions

View File

@ -2734,7 +2734,7 @@ SC_FUNC symbol *addvariable(const char *name,cell addr,int ident,int vclass,int
* this special case.
*/
assert(vclass!=sGLOBAL || (sym=findglb(name))==NULL || (sym->usage & uDEFINE)==0
|| sym->ident==iFUNCTN && sym==curfunc);
|| (sym->ident==iFUNCTN && sym==curfunc));
if (ident==iARRAY || ident==iREFARRAY) {
symbol *parent=NULL,*top;

View File

@ -2047,7 +2047,7 @@ static int nesting=0;
error(47); /* array sizes must match */
} /* if */
} /* if */
if (lval.ident!=iARRAYCELL) {
if (lval.ident!=iARRAYCELL|| lval.constval>0) {
/* save array size, for default values with uSIZEOF flag */
cell array_sz=lval.constval;
assert(array_sz!=0);/* literal array must have a size */