mirror of
https://github.com/frida/tinycc
synced 2024-11-24 08:39:37 +03:00
a number as a field name
a test program: ======== typedef struct X { int len; } X; int main(void) { X myX; myX.10 = 10; return 0; } ======== Error message before a patch: error: ';' expected (got "(null)") After a patch: error: field name expected
This commit is contained in:
parent
eb870b006c
commit
e7e7a0d301
6
tccgen.c
6
tccgen.c
@ -4152,7 +4152,7 @@ ST_FUNC void unary(void)
|
||||
if (tok == TOK_INC || tok == TOK_DEC) {
|
||||
inc(1, tok);
|
||||
next();
|
||||
} else if (tok == '.' || tok == TOK_ARROW) {
|
||||
} else if (tok == '.' || tok == TOK_ARROW || tok == TOK_CDOUBLE) {
|
||||
int qualifiers;
|
||||
/* field */
|
||||
if (tok == TOK_ARROW)
|
||||
@ -4160,10 +4160,12 @@ ST_FUNC void unary(void)
|
||||
qualifiers = vtop->type.t & (VT_CONSTANT | VT_VOLATILE);
|
||||
test_lvalue();
|
||||
gaddrof();
|
||||
next();
|
||||
/* expect pointer on structure */
|
||||
if ((vtop->type.t & VT_BTYPE) != VT_STRUCT)
|
||||
expect("struct or union");
|
||||
if (tok == TOK_CDOUBLE)
|
||||
expect("field name");
|
||||
next();
|
||||
s = vtop->type.ref;
|
||||
/* find field */
|
||||
tok |= SYM_FIELD;
|
||||
|
Loading…
Reference in New Issue
Block a user