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

Manuel Klimek via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 11 03:42:43 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL257326: Fix assert hit when tree-transforming template template parameter packs. (authored by klimek).

Changed prior to commit:
  http://reviews.llvm.org/D15743?vs=44451&id=44460#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D15743

Files:
  cfe/trunk/lib/Sema/TreeTransform.h
  cfe/trunk/test/SemaTemplate/temp_arg_template.cpp

Index: cfe/trunk/test/SemaTemplate/temp_arg_template.cpp
===================================================================
--- cfe/trunk/test/SemaTemplate/temp_arg_template.cpp
+++ cfe/trunk/test/SemaTemplate/temp_arg_template.cpp
@@ -75,7 +75,11 @@
 // expected-warning at -2 {{variadic templates are a C++11 extension}}
 #endif
 
-struct template_tuple {};
+struct template_tuple {
+#if __cplusplus >= 201103L
+  static constexpr int N = sizeof...(Templates);
+#endif
+};
 template <typename T>
 struct identity {};
 template <template <typename> class... Templates>
@@ -85,6 +89,12 @@
 
 template_tuple<Templates...> f7() {}
 
+#if __cplusplus >= 201103L
+struct S : public template_tuple<identity, identity> {
+  static_assert(N == 2, "Number of template arguments incorrect");
+};
+#endif
+
 void foo() {
   f7<identity>();
 }
Index: cfe/trunk/lib/Sema/TreeTransform.h
===================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h
+++ cfe/trunk/lib/Sema/TreeTransform.h
@@ -3583,7 +3583,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.44460.patch
Type: text/x-patch
Size: 1515 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160111/9b6c5ae0/attachment.bin>


More information about the cfe-commits mailing list