[cfe-commits] r116551 - in /cfe/trunk: lib/Parse/ParseTemplate.cpp test/Parser/cxx-template-decl.cpp
Douglas Gregor
dgregor at apple.com
Thu Oct 14 18:15:58 PDT 2010
Author: dgregor
Date: Thu Oct 14 20:15:58 2010
New Revision: 116551
URL: http://llvm.org/viewvc/llvm-project?rev=116551&view=rev
Log:
When we are missing the ',' or '>' to terminate a template parameter
list, complain about it! Fixes PR7053.
Modified:
cfe/trunk/lib/Parse/ParseTemplate.cpp
cfe/trunk/test/Parser/cxx-template-decl.cpp
Modified: cfe/trunk/lib/Parse/ParseTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTemplate.cpp?rev=116551&r1=116550&r2=116551&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTemplate.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTemplate.cpp Thu Oct 14 20:15:58 2010
@@ -337,7 +337,7 @@
// subsumed by whatever goes on in ParseTemplateParameter.
// TODO: This could match >>, and it would be nice to avoid those
// silly errors with template <vec<T>>.
- // Diag(Tok.getLocation(), diag::err_expected_comma_greater);
+ Diag(Tok.getLocation(), diag::err_expected_comma_greater);
SkipUntil(tok::greater, true, true);
return false;
}
Modified: cfe/trunk/test/Parser/cxx-template-decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-template-decl.cpp?rev=116551&r1=116550&r2=116551&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-template-decl.cpp (original)
+++ cfe/trunk/test/Parser/cxx-template-decl.cpp Thu Oct 14 20:15:58 2010
@@ -6,7 +6,9 @@
// expected-error {{does not refer}}
export template x; // expected-error {{expected '<' after 'template'}}
export template<class T> class x0; // expected-warning {{exported templates are unsupported}}
-template < ; // expected-error {{parse error}} expected-warning {{declaration does not declare anything}}
+template < ; // expected-error {{parse error}} \
+// expected-error{{expected ',' or '>' in template-parameter-list}} \
+// expected-warning {{declaration does not declare anything}}
template <template X> struct Err1; // expected-error {{expected '<' after 'template'}} \
// expected-error{{extraneous}}
template <template <typename> > struct Err2; // expected-error {{expected 'class' before '>'}} \
More information about the cfe-commits
mailing list