Skip to content

[Sema] Remove unnecessary casts (NFC) #149253

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions clang/lib/Sema/SemaTemplateDeduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3083,8 +3083,7 @@ static TemplateDeductionResult ConvertDeducedTemplateArguments(

// If there was no default argument, deduction is incomplete.
if (DefArg.getArgument().isNull()) {
Info.Param = makeTemplateParameter(
const_cast<NamedDecl *>(TemplateParams->getParam(I)));
Info.Param = makeTemplateParameter(TemplateParams->getParam(I));
Info.reset(
TemplateArgumentList::CreateCopy(S.Context, CTAI.SugaredConverted),
TemplateArgumentList::CreateCopy(S.Context, CTAI.CanonicalConverted));
Expand All @@ -3100,8 +3099,7 @@ static TemplateDeductionResult ConvertDeducedTemplateArguments(
if (S.CheckTemplateArgument(
Param, DefArg, TD, TD->getLocation(), TD->getSourceRange().getEnd(),
/*ArgumentPackIndex=*/0, CTAI, Sema::CTAK_Specified)) {
Info.Param = makeTemplateParameter(
const_cast<NamedDecl *>(TemplateParams->getParam(I)));
Info.Param = makeTemplateParameter(TemplateParams->getParam(I));
// FIXME: These template arguments are temporary. Free them!
Info.reset(
TemplateArgumentList::CreateCopy(S.Context, CTAI.SugaredConverted),
Expand Down Expand Up @@ -3227,7 +3225,7 @@ static TemplateDeductionResult FinishTemplateArgumentDeduction(
if (ParamIdx >= TPL->size())
ParamIdx = TPL->size() - 1;

Decl *Param = const_cast<NamedDecl *>(TPL->getParam(ParamIdx));
Decl *Param = TPL->getParam(ParamIdx);
Info.Param = makeTemplateParameter(Param);
Info.FirstArg = Ps[ArgIdx].getArgument();
return TemplateDeductionResult::SubstitutionFailure;
Expand Down
Loading