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

via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 01:00:25 PDT 2024


================
@@ -6371,6 +6376,70 @@ ASTContext::getCanonicalTemplateName(const TemplateName &Name) const {
         canonArgPack, subst->getAssociatedDecl()->getCanonicalDecl(),
         subst->getFinal(), subst->getIndex());
   }
+  case TemplateName::DeducedTemplate: {
+    assert(IgnoreDeduced == false);
+    DeducedTemplateStorage *DTS = Name.getAsDeducedTemplateName();
+    DefaultArguments DefArgs = DTS->getDefaultArguments();
+    TemplateName Underlying = DTS->getUnderlying();
+
+    bool NonCanonical = false;
+    TemplateName CanonUnderlying =
+        getCanonicalTemplateName(Underlying, /*IgnoreDeduced=*/true);
+    NonCanonical |= CanonUnderlying != Underlying;
----------------
cor3ntin wrote:

```suggestion
    bool NonCanonical = CanonUnderlying != Underlying;
```

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


More information about the cfe-commits mailing list