ref: c8abdfe1b720a9d786ea3fd840d48b744ef07e06
parent: 1dacb7932abe8799f3d0106d24c2615781dfe3a0
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Jul 11 05:50:31 EDT 2014
Allow labels with same name that a previous typedef Labels have a separate namespace, so it is correct this combination, but the problem is the lexer returns a different token for an identifier after a typedef for it. For example: main() { typedef int pepe; pepe: return 0; } The easier solution is a hack, where we modify the grammar to accept an IDEN or a TYPE when creating labels.
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -303,7 +303,7 @@
next();
return;
case TYPE:
- if (ahead() == ':')
+ if (yylval.token == TYPENAME && ahead() == ':')
goto statement;
/* pass through */
case SCLASS: case TQUALIFIER: