rjmccall added a comment.

I wrote this comment but apparently never submitted it on Phabricator, sorry.



================
Comment at: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1987
+
+    if (Function->getNumParams() >= NumTemplatedParams) {
+      unsigned FirstDefault = 0;
----------------
I don't think this simple comparison works; the relationship can be complicated 
because there might be multiple packs in play.  By the same token, I think it's 
possible that there can be multiple interleavings of defaultable parameters 
with packs.  I think you need to scan backwards looking for a parameter without 
a default argument that was instantiated from a pack expansion and then remove 
any earlier parameters with defaults.

That is, assuming this is a reasonable implementation approach at all compared 
to just teaching other parts of the compiler about this case, which I think 
Richard needs to weigh in on.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79800



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

Reply via email to