ActOnVariableDeclarator() sometimes calls setTemplateParameterListsInfo() with an empty template parameter list during error recovery.

Currently asserts on invalid with cases like these:

|template <class _Tp>||
||typename remove_reference {}||
||remove_reference<int> type;|

|template <class = void>||
||remove_reference;||
||remove_reference<>;|

The attached patch simply removes the assertion assert(NumTPLists > 0).

As far as I can tell the code path is equipped to deal with NumTPLists == 0 so this shouldn't cause a problem, but would appreciate review from someone familiar with the template code.

Related to PR17191.

Alp.


--
http://www.nuanti.com
the browser experts

diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index c75cf20..05f8baf 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -1513,7 +1513,6 @@ void
 DeclaratorDecl::setTemplateParameterListsInfo(ASTContext &Context,
                                               unsigned NumTPLists,
                                               TemplateParameterList **TPLists) 
{
-  assert(NumTPLists > 0);
   // Make sure the extended decl info is allocated.
   if (!hasExtInfo()) {
     // Save (non-extended) type source info pointer.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to