Violet marked 2 inline comments as done.
Violet added inline comments.

================
Comment at: clang/lib/Sema/SemaTemplateInstantiate.cpp:2895
       // function and isn't necessarily referring to one of FD's parameters.
-      if (FD->getParamDecl(i) == PV)
+      if (i < FD->getNumParams() && FD->getParamDecl(i) == PV)
         return FD->getCanonicalDecl()->getParamDecl(i);
----------------
lebedev.ri wrote:
> Have you analyzed how we get here?
> Maybe the caller code is faulty?
It's not the caller's fault. The cause is that a function pointer or a function 
typedef isn't a declcontext, so even if the getDeclContext() of its parameter 
returns a function, it has nothing to do with its own ParmVarDecl. That's why 
we check if the corresponding ParmVarDecl is the same one.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60055/new/

https://reviews.llvm.org/D60055



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to