Skip to content

Commit 6e6aa44

Browse files
authored
Revert "[Clang][Sema] fix outline member function template with defau… (#80144)
…lt align crash (#78400)" This reverts commit 7b33899. A regression was discovered here: #78400 and the author requested a revert to give time to review.
1 parent 47df391 commit 6e6aa44

File tree

3 files changed

+2
-65
lines changed

3 files changed

+2
-65
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,6 @@ Bug Fixes to C++ Support
164164

165165
- Fix crash when using lifetimebound attribute in function with trailing return.
166166
Fixes (`#73619 <https://github.com/llvm/llvm-project/issues/73619>`_)
167-
- Fix a crash when specializing an out-of-line member function with a default
168-
parameter where we did an incorrect specialization of the initialization of
169-
the default parameter.
170-
Fixes (`#68490 <https://github.com/llvm/llvm-project/issues/68490>`_)
171167
- Addressed an issue where constraints involving injected class types are perceived
172168
distinct from its specialization types.
173169
(`#56482 <https://github.com/llvm/llvm-project/issues/56482>`_)

clang/lib/Sema/SemaTemplateInstantiate.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3049,7 +3049,6 @@ bool Sema::SubstDefaultArgument(
30493049
// default argument expression appears.
30503050
ContextRAII SavedContext(*this, FD);
30513051
std::unique_ptr<LocalInstantiationScope> LIS;
3052-
MultiLevelTemplateArgumentList NewTemplateArgs = TemplateArgs;
30533052

30543053
if (ForCallExpr) {
30553054
// When instantiating a default argument due to use in a call expression,
@@ -3062,19 +3061,11 @@ bool Sema::SubstDefaultArgument(
30623061
/*ForDefinition*/ false);
30633062
if (addInstantiatedParametersToScope(FD, PatternFD, *LIS, TemplateArgs))
30643063
return true;
3065-
if (FD->isOutOfLine()) {
3066-
TemplateArgumentList *CurrentTemplateArgumentList =
3067-
TemplateArgumentList::CreateCopy(getASTContext(),
3068-
TemplateArgs.getInnermost());
3069-
NewTemplateArgs = getTemplateInstantiationArgs(
3070-
FD, FD->getDeclContext(), /*Final=*/false,
3071-
CurrentTemplateArgumentList, /*RelativeToPrimary=*/true);
3072-
}
30733064
}
30743065

30753066
runWithSufficientStackSpace(Loc, [&] {
3076-
Result = SubstInitializer(PatternExpr, NewTemplateArgs,
3077-
/*DirectInit*/ false);
3067+
Result = SubstInitializer(PatternExpr, TemplateArgs,
3068+
/*DirectInit*/false);
30783069
});
30793070
}
30803071
if (Result.isInvalid())

clang/test/SemaTemplate/default-parm-init.cpp

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)