[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #94981)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 15:24:26 PDT 2024


================
@@ -9434,6 +9505,32 @@ ASTContext::getSubstTemplateTemplateParmPack(const TemplateArgument &ArgPack,
   return TemplateName(Subst);
 }
 
+/// Retrieve the template name that represents a template name
+/// deduced from a specialization.
+TemplateName
+ASTContext::getDeducedTemplateName(TemplateName Underlying,
+                                   DefaultArguments DefaultArgs) const {
+  if (!DefaultArgs)
+    return Underlying;
+
+  auto &Self = const_cast<ASTContext &>(*this);
----------------
mizvekov wrote:

This is done throughout the ASTContext and is not novel here.

We wish to be able to create a new node from a const ASTContext reference.

These creation functions mostly behave const-ish, they just use hash tables in the ASTContext for caching / identity purposes.

The other alternative is to declare these hash tables as mutable, though this would necessitate a large noisy change to update everything at once.

https://github.com/llvm/llvm-project/pull/94981


More information about the cfe-commits mailing list