This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C PATCH] Fix parsing when using declarations in for loops and typedefs (PR c/67784)
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 12 Nov 2015 20:59:07 +0000
- Subject: Re: [C PATCH] Fix parsing when using declarations in for loops and typedefs (PR c/67784)
- Authentication-results: sourceware.org; auth=none
- References: <20151112195719 dot GG3185 at redhat dot com>
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