This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C PATCH] Fix parsing when using declarations in for loops and typedefs (PR c/67784)


On Thu, 12 Nov 2015, Marek Polacek wrote:

> As explained in the PR, the issue here was that we were treating a TYPENAME
> wrongly as an ID.  That happened because we were using information from the
> wrong scope when parsing a token after an else clause.  I.e. in fn1 in the
> attached testcase we need to examine the token after "if (1);" to see if it's
> the "else" keyword, but when it's not, we use the scope of the for loop when
> classifying the token, so we wrongly see "T" as a identifier of a variable.
> Fixed by examining the token again and reclassifying it.
> 
> Moreover, we were ICEing in a similar scenario, treating ID as a TYPENAME, as
> demonstrated in pr67784-2.c.  The fix is analogical.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?

OK.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]