[PATCH] D15743: Fix assert hit when tree-transforming template template parameter packs.

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 23 05:06:47 PST 2015

klimek created this revision.
klimek added a reviewer: rsmith.
klimek added a subscriber: cfe-commits.

Covers significantly more code in the template template pack argument
test and fixes the resulting assert problem.



Index: test/SemaTemplate/temp_arg_template.cpp
--- test/SemaTemplate/temp_arg_template.cpp
+++ test/SemaTemplate/temp_arg_template.cpp
@@ -75,7 +75,11 @@
 // expected-warning at -2 {{variadic templates are a C++11 extension}}
-struct template_tuple {};
+struct template_tuple {
+#if __cplusplus >= 201103L
+  static constexpr int N = sizeof...(Templates);
 template <typename T>
 struct identity {};
 template <template <typename> class... Templates>
Index: lib/Sema/TreeTransform.h
--- lib/Sema/TreeTransform.h
+++ lib/Sema/TreeTransform.h
@@ -3582,7 +3582,7 @@
   case TemplateArgument::Template:
   case TemplateArgument::TemplateExpansion: {
     NestedNameSpecifierLocBuilder Builder;
-    TemplateName Template = Arg.getAsTemplate();
+    TemplateName Template = Arg.getAsTemplateOrTemplatePattern();
     if (DependentTemplateName *DTN = Template.getAsDependentTemplateName())
       Builder.MakeTrivial(SemaRef.Context, DTN->getQualifier(), Loc);
     else if (QualifiedTemplateName *QTN = Template.getAsQualifiedTemplateName())

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15743.43523.patch
Type: text/x-patch
Size: 1192 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151223/1b2dd299/attachment.bin>

More information about the cfe-commits mailing list