Merge pull request #454 from Daniel-Cortez/unnamed-enum-tags-fix
Do not allow tags inside the braces of unnamed enums
This commit is contained in:
commit
df323449ad
@ -2967,7 +2967,7 @@ static void decl_enum(int vclass,int fstatic)
|
|||||||
lexpush();
|
lexpush();
|
||||||
break;
|
break;
|
||||||
} /* if */
|
} /* if */
|
||||||
idxtag=pc_addtag(NULL); /* optional explicit item tag */
|
idxtag=(enumname[0]=='\0') ? tag : pc_addtag(NULL); /* optional explicit item tag */
|
||||||
if (needtoken(tSYMBOL)) { /* read in (new) token */
|
if (needtoken(tSYMBOL)) { /* read in (new) token */
|
||||||
tokeninfo(&val,&str); /* get the information */
|
tokeninfo(&val,&str); /* get the information */
|
||||||
strcpy(constname,str); /* save symbol name */
|
strcpy(constname,str); /* save symbol name */
|
||||||
|
7
source/compiler/tests/anonymous_enum_tags.meta
Normal file
7
source/compiler/tests/anonymous_enum_tags.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
'test_type': 'output_check',
|
||||||
|
'errors': """
|
||||||
|
anonymous_enum_tags.pwn(4) : error 001: expected token: "-identifier-", but found "-label-"
|
||||||
|
anonymous_enum_tags.pwn(11) : error 001: expected token: "-identifier-", but found "-label-"
|
||||||
|
"""
|
||||||
|
}
|
29
source/compiler/tests/anonymous_enum_tags.pwn
Normal file
29
source/compiler/tests/anonymous_enum_tags.pwn
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
enum
|
||||||
|
{
|
||||||
|
CONST1,
|
||||||
|
Float:CONST2, // error
|
||||||
|
CONST3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Float:
|
||||||
|
{
|
||||||
|
CONST4,
|
||||||
|
_:CONST5, // error
|
||||||
|
CONST6
|
||||||
|
};
|
||||||
|
|
||||||
|
enum eNamed1
|
||||||
|
{
|
||||||
|
CONST7,
|
||||||
|
Float:CONST8,
|
||||||
|
CONST9
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Float:eNamed2
|
||||||
|
{
|
||||||
|
CONST10,
|
||||||
|
Float:CONST11,
|
||||||
|
CONST12
|
||||||
|
};
|
||||||
|
|
||||||
|
main(){}
|
Loading…
x
Reference in New Issue
Block a user