================
@@ -58,10 +58,10 @@ getDerivedParameter(const ClassTemplateSpecializationDecl 
*CRTP,
                Arg.getAsType()->getAsCXXRecordDecl() == Derived;
       });
 
-  return AnyOf ? CRTP->getSpecializedTemplate()
-                     ->getTemplateParameters()
-                     ->getParam(Idx - 1)
-               : nullptr;
+  return AnyOf && Idx > 0 ? CRTP->getSpecializedTemplate()
----------------
AaronBallman wrote:

I don't think it's possible for `AnyOf` to be `true` and `Idx` to be `0` at the 
same time. `Idx` starts as zero, but the call to `any_of` on line 54 has a 
lambda which explicitly does `++Idx`, so `any_of` cannot return `true` without 
incrementing `Idx`.

If this came from a static analysis tool, I would claim it's a false positive 
that doesn't require changes.

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

Reply via email to