[cfe-commits] [PATCH] Improve the diagnostic for forgotten template arguments

Douglas Gregor dgregor at apple.com
Wed Apr 7 08:56:10 PDT 2010


Hi Jeffrey,

On Apr 4, 2010, at 2:10 AM, Jeffrey Yasskin wrote:

>> From the test:
> 
> namespace ns {
> template<typename T> class B {};  // expected-note{{template is declared here}}
> }
> A<ns::B> a8; // expected-error{{class template-name ns::B requires
> template arguments to produce a type}}
> 
> Clang used to just complain that the argument wasn't a type, which
> confused users.


Thank you for improving these diagnostics. Just one comment:

Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td	(revision 100307)
+++ include/clang/Basic/DiagnosticSemaKinds.td	(working copy)
@@ -1178,6 +1178,8 @@
   "cannot refer to class template %0 without a template argument list">;
 
 // C++ Template Argument Lists
+def err_template_missing_args : Error<
+  "class template-name %0 requires template arguments to produce a type">;

"template-name" sounds too much like a grammar term. How about 

	"use of class template %0 requires template arguments"

?

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100407/d8def2bd/attachment.html>


More information about the cfe-commits mailing list