On Tue, Apr 26, 2016 at 03:06:16PM +0200, Marek Polacek wrote: > On Tue, Apr 26, 2016 at 11:44:52AM +0000, Joseph Myers wrote: > > On Tue, 26 Apr 2016, Marek Polacek wrote: > > > > > This PR was reopened, because the exact same problem with treating a > > > TYPENAME > > > wrongly as an ID was found when using just if-clause, without an > > > enclosing for > > > loop. More details: > > > <https://gcc.gnu.org/ml/gcc-patches/2015-11/msg01588.html>. > > > That fix had a follow-up, because it broke some ObjC code. > > > > > > To fix this, we need to use the (amended) token reclassification even when > > > parsing an if statement. I factored the code into a separate function so > > > as to > > > not repeat the very same code. > > > > > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > > > I think you need more thorough testcases, to cover the cases where the if > > statement with no else forms the body of a switch or while statement, and > > the declaration in question appears in the expression of that switch or > > while statement, e.g. > > > > typedef int T; > > > > switch (sizeof (enum { T })) > > if (1) > > ; > > T x; > > Ah, right, that revealed two more places that were missing the > c_parser_maybe_reclassify_token call.
Bet there are many more, the various OpenMP/OpenACC/Cilk+ loops (if without {}s around the body or in between collapsed loops), perhaps even #pragma GCC ivdep. But I can handle those incrementally. Jakub