<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Aug 9, 2010, at 3:28 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 9, 2010, at 10:40 PM, Douglas Gregor wrote:</div><div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>On Aug 9, 2010, at 2:08 PM, Argyrios Kyrtzidis wrote:<br><br><blockquote type="cite">Author: akirtzidis<br></blockquote><blockquote type="cite">Date: Mon Aug  9 16:08:13 2010<br></blockquote><blockquote type="cite">New Revision: 110603<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project?rev=110603&view=rev">http://llvm.org/viewvc/llvm-project?rev=110603&view=rev</a><br></blockquote><blockquote type="cite">Log:<br></blockquote><blockquote type="cite">Change warning about incomplete parsing of C++ default arg to error and provide a test case; thanks Doug!<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified:<br></blockquote><blockquote type="cite">   cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td<br></blockquote><blockquote type="cite">   cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp<br></blockquote><blockquote type="cite">   cfe/trunk/test/Parser/cxx-default-args.cpp<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified: cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td<br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=110603&r1=110602&r2=110603&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td?rev=110603&r1=110602&r2=110603&view=diff</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td (original)<br></blockquote><blockquote type="cite">+++ cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td Mon Aug  9 16:08:13 2010<br></blockquote><blockquote type="cite">@@ -271,8 +271,8 @@<br></blockquote><blockquote type="cite">  "expected a class name after '~' to name a destructor">;<br></blockquote><blockquote type="cite">def err_destructor_template_id : Error<<br></blockquote><blockquote type="cite">  "destructor name %0 does not refer to a template">;<br></blockquote><blockquote type="cite">-def warn_default_arg_unparsed : Warning<<br></blockquote><blockquote type="cite">-  "parsing of default argument is incomplete">;<br></blockquote><blockquote type="cite">+def err_default_arg_unparsed : Error<<br></blockquote><blockquote type="cite">+  "unexpected end of default argument expression">;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">// C++ derived classes<br></blockquote><blockquote type="cite">def err_dup_virtual : Error<"duplicate 'virtual' in base specifier">;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp<br></blockquote><blockquote type="cite">URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=110603&r1=110602&r2=110603&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=110603&r1=110602&r2=110603&view=diff</a><br></blockquote><blockquote type="cite">==============================================================================<br></blockquote><blockquote type="cite">--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)<br></blockquote><blockquote type="cite">+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Mon Aug  9 16:08:13 2010<br></blockquote><blockquote type="cite">@@ -145,12 +145,8 @@<br></blockquote><blockquote type="cite">        else {<br></blockquote><blockquote type="cite">          if (<a href="http://Tok.is/">Tok.is</a>(tok::cxx_defaultarg_end))<br></blockquote><blockquote type="cite">            ConsumeToken();<br></blockquote><blockquote type="cite">-          else {<br></blockquote><blockquote type="cite">-            // Warn that there are tokens from the default arg that we left<br></blockquote><blockquote type="cite">-            // unparsed. This actually indicates a bug in clang but we avoid<br></blockquote><blockquote type="cite">-            // asserting because we want the parser robust.<br></blockquote><blockquote type="cite">-            Diag(Tok.getLocation(), diag::warn_default_arg_unparsed);<br></blockquote><blockquote type="cite">-          }<br></blockquote><blockquote type="cite">+          else<br></blockquote><blockquote type="cite">+            Diag(Tok.getLocation(), diag::err_default_arg_unparsed);<br></blockquote><br>Shouldn't we be consuming all of the tokens up to the tok::cxx_defaultarg_end?<br></div></blockquote><div><br></div><div>That happens later, all tokens from default arg are consumed:</div><div><br></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(71, 144, 117); "><span style="color: rgb(0, 0, 0); ">        </span>// There could be leftover tokens (e.g. because of an error).</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(71, 144, 117); "><span style="color: rgb(0, 0, 0); ">        </span>// Skip through until we reach the original token position.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">        <span style="color: rgb(151, 19, 101); ">while</span> (<span style="color: rgb(33, 33, 196); ">Tok</span>.getLocation() <span style="color: rgb(214, 119, 38); ">!=</span> origLoc && <span style="color: rgb(33, 33, 196); ">Tok</span>.isNot(tok::eof))</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; ">          ConsumeAnyToken();</div></div></div></div></blockquote><br></div><div>Okay, thanks!</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Doug</div><br></body></html>