[clang] [Clang][Sema] Fix a bug on template partial specialization with issue on deduction of nontype tempalte parameter (PR #90376)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 28 00:26:46 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(),
----------------
zyn0217 wrote:
Did you try to preserve the references using `SubstNonTypeTemplateParmExpr`s just like what @cor3ntin said? This looks a bit odd to me...
https://github.com/llvm/llvm-project/pull/90376
More information about the cfe-commits
mailing list