diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 780716b089e4..35ab1461e7b8 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -798,6 +798,7 @@ Bug Fixes to C++ Support - Fix instantiation of default-initialized variable template specialization. (#GH140632) (#GH140622) - Clang modules now allow a module and its user to differ on TrivialAutoVarInit* - Fixed an access checking bug when initializing non-aggregates in default arguments (#GH62444), (#GH83608) +- Fixed a pack substitution bug in deducing class template partial specializations. (#GH53609) Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 217d57d67f06..75ae04b27d06 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -2946,6 +2946,7 @@ ConvertDeducedTemplateArgument(Sema &S, NamedDecl *Param, LocalInstantiationScope Scope(S); MultiLevelTemplateArgumentList Args(Template, CTAI.SugaredConverted, /*Final=*/true); + Sema::ArgPackSubstIndexRAII OnlySubstNonPackExpansion(S, std::nullopt); if (auto *NTTP = dyn_cast(Param)) { Sema::InstantiatingTemplate Inst(S, Template->getLocation(), Template, diff --git a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp index f0ab7b8ea761..de6fa0c837e2 100644 --- a/clang/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp +++ b/clang/test/CXX/temp/temp.fct.spec/temp.deduct/p7.cpp @@ -54,3 +54,20 @@ namespace reversed_operator_substitution_order { float &s = no_adl::f(true); } #endif + +namespace GH53609 { + +template +struct a; + +template +struct b; + +template +struct b...> {}; + +template struct c: b... {}; + +c d; + +}