[PATCH] D20511: Fix crash while parsing variable template with variadic template arguments

Olivier Goffart via cfe-commits cfe-commits at lists.llvm.org
Thu May 26 06:02:00 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL270845: Fix crash while parsing variable template with variadic template arguments (authored by ogoffart).

Changed prior to commit:
  http://reviews.llvm.org/D20511?vs=58043&id=58595#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20511

Files:
  cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
  cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp

Index: cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
+++ cfe/trunk/test/SemaCXX/cxx1y-variable-templates_top_level.cpp
@@ -458,3 +458,9 @@
   template<> int g<double>; // expected-error {{no variable template matches specialization; did you mean to use 'g' as function template instead?}}
 }
 
+#ifndef PRECXX11
+template <typename... Args> struct Variadic_t { };
+template <typename... Args> Variadic_t<Args...> Variadic;
+auto variadic1 = Variadic<>;
+auto variadic2 = Variadic<int, int>;
+#endif
Index: cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
===================================================================
--- cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
+++ cfe/trunk/lib/Sema/SemaTemplateVariadic.cpp
@@ -604,7 +604,7 @@
     //   Template argument deduction can extend the sequence of template 
     //   arguments corresponding to a template parameter pack, even when the
     //   sequence contains explicitly specified template arguments.
-    if (!IsFunctionParameterPack) {
+    if (!IsFunctionParameterPack && CurrentInstantiationScope) {
       if (NamedDecl *PartialPack 
                     = CurrentInstantiationScope->getPartiallySubstitutedPack()){
         unsigned PartialDepth, PartialIndex;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20511.58595.patch
Type: text/x-patch
Size: 1372 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160526/d651ae8c/attachment.bin>


More information about the cfe-commits mailing list