Skip to content

Commit

Permalink
Revert "[Clang][Sema] fix outline member function template with defau… (
Browse files Browse the repository at this point in the history
llvm#80144)

…lt align crash (llvm#78400)"

This reverts commit 7b33899.

A regression was discovered here:
llvm#78400

and the author requested a revert to give time to review.
  • Loading branch information
erichkeane committed Jan 31, 2024
1 parent 47df391 commit 6e6aa44
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 65 deletions.
4 changes: 0 additions & 4 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ Bug Fixes to C++ Support

- Fix crash when using lifetimebound attribute in function with trailing return.
Fixes (`#73619 <https://github.com/llvm/llvm-project/issues/73619>`_)
- Fix a crash when specializing an out-of-line member function with a default
parameter where we did an incorrect specialization of the initialization of
the default parameter.
Fixes (`#68490 <https://github.com/llvm/llvm-project/issues/68490>`_)
- Addressed an issue where constraints involving injected class types are perceived
distinct from its specialization types.
(`#56482 <https://github.com/llvm/llvm-project/issues/56482>`_)
Expand Down
13 changes: 2 additions & 11 deletions clang/lib/Sema/SemaTemplateInstantiate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3049,7 +3049,6 @@ bool Sema::SubstDefaultArgument(
// default argument expression appears.
ContextRAII SavedContext(*this, FD);
std::unique_ptr<LocalInstantiationScope> LIS;
MultiLevelTemplateArgumentList NewTemplateArgs = TemplateArgs;

if (ForCallExpr) {
// When instantiating a default argument due to use in a call expression,
Expand All @@ -3062,19 +3061,11 @@ bool Sema::SubstDefaultArgument(
/*ForDefinition*/ false);
if (addInstantiatedParametersToScope(FD, PatternFD, *LIS, TemplateArgs))
return true;
if (FD->isOutOfLine()) {
TemplateArgumentList *CurrentTemplateArgumentList =
TemplateArgumentList::CreateCopy(getASTContext(),
TemplateArgs.getInnermost());
NewTemplateArgs = getTemplateInstantiationArgs(
FD, FD->getDeclContext(), /*Final=*/false,
CurrentTemplateArgumentList, /*RelativeToPrimary=*/true);
}
}

runWithSufficientStackSpace(Loc, [&] {
Result = SubstInitializer(PatternExpr, NewTemplateArgs,
/*DirectInit*/ false);
Result = SubstInitializer(PatternExpr, TemplateArgs,
/*DirectInit*/false);
});
}
if (Result.isInvalid())
Expand Down
50 changes: 0 additions & 50 deletions clang/test/SemaTemplate/default-parm-init.cpp

This file was deleted.

0 comments on commit 6e6aa44

Please sign in to comment.