rsmith added inline comments.

================
Comment at: clang/lib/Serialization/ASTReaderDecl.cpp:3784-3790
+  if (auto *TD = dyn_cast<TemplateDecl>(D)) {
+    // CXXDeductionGuideDecls reference the class template parameters so we 
need
+    // to make sure not to call this twice on the same template parameters.
+    if (!isa<CXXDeductionGuideDecl>(TD->getTemplatedDecl()))
+      inheritDefaultTemplateArguments(Reader.getContext(),
+                                      cast<TemplateDecl>(Previous), TD);
+  }
----------------
An implicit deduction guide can get template parameters from both the class 
template and the constructor template. The ones from the class template are not 
copied and owned by the deduction guide, but the ones from the constructor 
template are. So I think we may need to do this for *some* of the template 
parameters and not others. Perhaps we could check to see if the template 
parameter is actually owned by this template and skip updating it if not.

(Alternatively, I think it'd be fine, and probably simpler and cleaner, to make 
implicit deduction guide generation always clone the template parameters of the 
class template. The confusion caused by having the template parameters appear 
in the "wrong" template is probably not justified by the time / memory savings.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114908

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D114908: ... Reid Kleckner via Phabricator via cfe-commits
    • [PATCH] D114... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D114... Arthur Eubanks via Phabricator via cfe-commits
    • [PATCH] D114... Chuanqi Xu via Phabricator via cfe-commits

Reply via email to