[clang] [Clang][Sema] Fix a bug on template partial specialization with issue on deduction of nontype tempalte parameter (PR #90376)
Qizhi Hu via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 28 02:08:37 PDT 2024
================
@@ -8508,6 +8507,16 @@ Sema::BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
} else {
assert(ParamType->isReferenceType() &&
"unexpected type for decl template argument");
+ if (ParamType->isLValueReferenceType())
+ if (NonTypeTemplateParmDecl *NTTP =
+ dyn_cast_if_present<NonTypeTemplateParmDecl>(TemplateParam)) {
+ QualType TemplateParamType = NTTP->getType();
+ const AutoType *AT = TemplateParamType->getAs<AutoType>();
+ if (AT && AT->isDecltypeAuto())
+ RefExpr = new (getASTContext())
+ ParenExpr(RefExpr.get()->getBeginLoc(),
----------------
jcsxky wrote:
Ah, thanks for your remind! `SubstNonTypeTemplateParmExpr` is more suitable here.
https://github.com/llvm/llvm-project/pull/90376
More information about the cfe-commits
mailing list