[Bug c/67784] Incorrect parsing when using declarations in for loops and typedefs

joseph at codesourcery dot com gcc-bugzilla@gcc.gnu.org
Thu Nov 12 13:58:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67784

--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
The reason is as stated in comment#1: it's necessary to examine the token 
after "if ( 1 ) ;" to see if it's the "else" keyword; if it were "else", 
that token would be within the C99/C11 block scope of the "for" loop, but 
if it's something else then it's outside that block scope.  But examining 
it to determine whether it's "else" also classifies it as not a typedef, 
using information from the wrong scope.  So on leaving such a scope for a 
"for" loop, any previously-lexed identifier token after the loop may need 
reclassifying based on the correct scope.


More information about the Gcc-bugs mailing list