On Aug 6, 2010, at 8:58 PM, Douglas Gregor wrote: > > On Aug 6, 2010, at 9:02 PM, Argyrios Kyrtzidis wrote: > >> On Aug 6, 2010, at 4:41 PM, Ted Kremenek wrote: >> >>> On Aug 6, 2010, at 3:13 AM, Douglas Gregor <[email protected]> wrote: >>> >>>>> + assert(Tok.is(tok::cxx_defaultarg_end) && >>>>> + "We didn't parse the whole default arg!"); >>>>> + ConsumeToken(); // Consume tok::cxx_defaultarg_end. >>>> >>>> How about we SkipUntil the tok::cxx_defaultarg_end, and give an error if >>>> it's not the next token? That way, if expression parsing doesn't use up >>>> all of the tokens, we'll give a reasonable diagnostic rather than >>>> asserting. >>> >>> +1. Assertions for cases that might trigger on invalid code are highly >>> undesirable. I'm not certain if that is the case here, but it looks like >>> it to me. >> >> It won't be triggered on invalid code, it's supposed to be triggered when >> clang left tokens while no errors occured. > > I don't agree. The parsing code before this calls > ParseAssignmentExpression(). It's entirely possible that something could go > wrong in parsing such an expression that causes extra tokens to be left in > the token stream.
Yes, and the assertion would catch that something instead of ignoring it :-) Anyway, point taken, I'll remove the assertion. -Argiris > We should consume all of the tokens up to and including the > tok::cxx_defaultarg_end so that we know that the parser is in a perfect state > once we've finished parsing the default argument. > > - Doug
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
