[clang] [clang] fix getReplacedTemplateParameter for function template specializations (PR #189559)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 08:58:22 PDT 2026


================
@@ -1707,10 +1707,12 @@ clang::getReplacedTemplateParameter(Decl *D, unsigned Index) {
   case Decl::Kind::CXXConstructor:
   case Decl::Kind::CXXDestructor:
   case Decl::Kind::CXXMethod:
-  case Decl::Kind::Function:
-    return getReplacedTemplateParameter(
-        cast<FunctionDecl>(D)->getTemplateSpecializationInfo()->getTemplate(),
-        Index);
+  case Decl::Kind::Function: {
+    const FunctionTemplateSpecializationInfo *Info =
+        cast<FunctionDecl>(D)->getTemplateSpecializationInfo();
+    return {Info->getTemplate()->getTemplateParameters()->getParam(Index),
----------------
mizvekov wrote:

You mean this function? I am confused.

https://github.com/llvm/llvm-project/pull/189559


More information about the cfe-commits mailing list