[clang] [clang] Distinguish NTTPs with deduced types in variable template partial specializations (PR #152864)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 9 12:43:55 PDT 2025
================
@@ -4126,7 +4126,11 @@ static bool isTemplateArgumentTemplateParameter(const TemplateArgument &Arg,
return false;
const NonTypeTemplateParmDecl *NTTP =
dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl());
- return NTTP && NTTP->getDepth() == Depth && NTTP->getIndex() == Index;
+ if (!NTTP || NTTP->getDepth() != Depth || NTTP->getIndex() != Index)
+ return false;
+ QualType ParamType = cast<NonTypeTemplateParmDecl>(Param)->getType();
+ QualType NTTPType = NTTP->getType();
+ return ParamType.getCanonicalType() == NTTPType.getCanonicalType();
----------------
mizvekov wrote:
Yeah what you said makes sense, they are not the same parameter. But if this is worried specifically about a parameter from the primary template, that could be tested for instead, along with its index.
The function has a single user, so you can probably change it however and rename it, or move the test to the user and then remove the function seems fine to me as well.
https://github.com/llvm/llvm-project/pull/152864
More information about the cfe-commits
mailing list