Author: Matheus Izvekov Date: 2026-02-25T12:53:35-03:00 New Revision: 787ba2426148ff0fa0c0253f6e4cc11e5cfe8361
URL: https://github.com/llvm/llvm-project/commit/787ba2426148ff0fa0c0253f6e4cc11e5cfe8361 DIFF: https://github.com/llvm/llvm-project/commit/787ba2426148ff0fa0c0253f6e4cc11e5cfe8361.diff LOG: [clang] create local instantiation scope for matching template template parameters (#183219) This fixes a bug where a partial substitution from the enclosing scope is used to prepopulate an unrelated template argument deduction. Fixes #181166 Added: Modified: clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaTemplateDeduction.cpp clang/test/SemaTemplate/temp_arg_template_p0522.cpp Removed: ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index cb1010aee1edd..bb8d4a621c515 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -308,6 +308,8 @@ Bug Fixes to Attribute Support Bug Fixes to C++ Support ^^^^^^^^^^^^^^^^^^^^^^^^ - Fixed a crash when instantiating ``requires`` expressions involving substitution failures in C++ concepts. (#GH176402) +- Fixed an incorrect template argument deduction when matching packs of template + template parameters when one of its parameters is also a pack. (#GH181166) - Fixed a crash when a default argument is passed to an explicit object parameter. (#GH176639) - Fixed a crash when diagnosing an invalid static member function with an explicit object parameter (#GH177741) - Fixed a bug where captured variables in non-mutable lambdas were incorrectly treated as mutable @@ -463,8 +465,8 @@ Python Binding Changes Affected methods: ``isKindOptional``, ``isKindTypedText``, ``isKindPlaceHolder``, ``isKindInformative`` and ``isKindResultType``. - Add a deprecation warning to ``CodeCompletionResults.results``. - This property will become an implementation detail with changed behavior in a - future release and should not be used directly.. Existing uses of + This property will become an implementation detail with changed behavior in a + future release and should not be used directly.. Existing uses of ``CodeCompletionResults.results`` should be changed to directly use ``CodeCompletionResults``: it nows supports ``__len__`` and ``__getitem__``, so it can be used the same as ``CodeCompletionResults.results``. diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index b6f7866d69ed6..03040d2ffec7d 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -6502,6 +6502,8 @@ bool Sema::isTemplateTemplateParameterAtLeastAsSpecializedAs( if (Inst.isInvalid()) return false; + LocalInstantiationScope Scope(*this); + // Given an invented class template X with the template parameter list of // A (including default arguments): // - Each function template has a single function parameter whose type is diff --git a/clang/test/SemaTemplate/temp_arg_template_p0522.cpp b/clang/test/SemaTemplate/temp_arg_template_p0522.cpp index 60d98a653ff02..bde811c3bf685 100644 --- a/clang/test/SemaTemplate/temp_arg_template_p0522.cpp +++ b/clang/test/SemaTemplate/temp_arg_template_p0522.cpp @@ -168,3 +168,10 @@ namespace GH101394 { // expected-note@#B {{passing argument to parameter here}} } // namespace t2 } // namespace GH101394 + +namespace GH181166 { + template <template <class...> class> struct A; + template <template <class...> class... TT1> A<TT1...> f(); + template <class ...Ts> struct B {}; + using T = decltype(f<B>()); +} // namespace GH181166 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
