================
@@ -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:

FWIW the Depth and Index passed into this function are also redundant with 
Param's depth and Index.

But if this function is just trying to test whether the template argument 
refers to the given template parameter,
it would be sufficient instead to just test that they have the DeclContext is 
the same entity and that they have the same index.

Testing index depth and type instead may have false positives.


https://github.com/llvm/llvm-project/pull/152864
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to