<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 6, 2010, at 9:02 PM, Argyrios Kyrtzidis wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>On Aug 6, 2010, at 4:41 PM, Ted Kremenek wrote:</div><div><br class="Apple-interchange-newline"><blockquote type="cite"><div bgcolor="#FFFFFF"><div><span class="Apple-style-span" style="-webkit-tap-highlight-color: rgba(26, 26, 26, 0.296875); -webkit-composition-fill-color: rgba(175, 192, 227, 0.230469); -webkit-composition-frame-color: rgba(77, 128, 180, 0.230469); ">On Aug 6, 2010, at 3:13 AM, Douglas Gregor <<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>> wrote:</span></div><div><br></div><blockquote type="cite"><blockquote type="cite"><span>+          assert(<a href="http://Tok.is/" x-apple-data-detectors="true"></a><a href="http://Tok.is/">Tok.is</a>(tok::cxx_defaultarg_end) &&</span><br></blockquote><blockquote type="cite"><span>+                 "We didn't parse the whole default arg!");</span><br></blockquote><blockquote type="cite"><span>+          ConsumeToken(); // Consume tok::cxx_defaultarg_end.</span><br></blockquote><span></span><br><span>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.</span></blockquote><br><div></div><div>+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.</div></div></blockquote><br></div><div>It won't be triggered on invalid code, it's supposed to be triggered when clang left tokens while no errors occured.</div></div></blockquote><br></div><div>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. 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.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">   </span>- Doug</div></body></html>