<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/5/1 Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span><br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
<br>
================<br>
Comment at: include/clang/Basic/DiagnosticParseKinds.td:592<br>
@@ -591,2 +591,3 @@<br>
<div class="im"> def err_expected_template_parameter : Error<"expected template parameter">;<br>
+def err_missed_templ_params : Error<"template parameter list is missed">;<br>
<br>
</div>----------------<br>
Maybe "missing template parameter list in %select{class|struct|union}0 template definition", and rename to something like err_template_missing_parameters. But... if the 'template' keyword is just spurious here, this might still be confusing. Maybe we should just say "unexpected 'template' keyword before %select{class|struct|union}0 definition"?<br>
</blockquote><div><br>It looks like the message "missing template parameter list in ..." is a 
bit more user-friendly. The message "unexpected 'template' keyword..." 
could be confusing for unexperienced user.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
================<br>
Comment at: lib/Parse/ParseDeclCXX.cpp:1541-1542<br>
@@ -1539,1 +1540,4 @@<br>
<div class="im">+             TUK == Sema::TUK_Definition) {<br>
+    if (!TemplateParams)<br>
+      Diag (TemplateInfo.TemplateLoc, diag::err_missed_templ_params);<br>
   } else {<br>
</div>----------------<br>
Is it possible for TemplateParams to be non-null for an ExplicitInstantiation?<br></blockquote><div><br>TemplateParams is set up when a token of kind tok::annot_template_id is 
found. It must not be null, otherwise it would mean that information on template 
being instantiating is unavailable.<br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
If we expect this to happen due to a missing template parameter list, we're not going to recover very well here -- the class body is going to have a bunch of undeclared identifiers in it, and later uses of the class template are going to hit parse errors, because we won't treat the class name as a template name.<br>
</blockquote><div><br>Some extent of recovering is useful however. Currently clang parses 
class body even in template-parameter-list has errors. So parsing the 
body may be useful also in the case of absent parameters. </div></div><br><br>-- <br>Thanks,<br>--Serge<br>
</div></div>