[PATCH] D133874: [clang] Changes to produce sugared converted template arguments

Mike Hommey via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 17:38:25 PDT 2022


glandium added a comment.

I can confirm that applying the following:

  diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
  index a8585a6d84ad..f07c40cb6c5d 100644
  --- a/clang/lib/AST/ASTContext.cpp
  +++ b/clang/lib/AST/ASTContext.cpp
  @@ -6774,7 +6774,7 @@ ASTContext::getCanonicalTemplateArgument(const TemplateArgument &Arg) const {
   
       case TemplateArgument::Declaration: {
         auto *D = cast<ValueDecl>(Arg.getAsDecl()->getCanonicalDecl());
  -      return TemplateArgument(D, Arg.getParamTypeForDecl());
  +      return TemplateArgument(D, getCanonicalType(Arg.getParamTypeForDecl()));
       }
   
       case TemplateArgument::NullPtr:
  diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
  index 6d9ab2b8ca71..579684c94f80 100644
  --- a/clang/lib/AST/TemplateBase.cpp
  +++ b/clang/lib/AST/TemplateBase.cpp
  @@ -363,7 +363,8 @@ bool TemplateArgument::structurallyEquals(const TemplateArgument &Other) const {
              TemplateArg.NumExpansions == Other.TemplateArg.NumExpansions;
   
     case Declaration:
  -    return getAsDecl() == Other.getAsDecl();
  +    return getAsDecl() == Other.getAsDecl() &&
  +           getParamTypeForDecl() == Other.getParamTypeForDecl();
   
     case Integral:
       return getIntegralType() == Other.getIntegralType() &&

on top of the commit right before your reverts, fixes both the issue I reported here as well as the one in D136564 <https://reviews.llvm.org/D136564>.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D133874



More information about the cfe-commits mailing list