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;
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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits