[clang] [Clang] prevent assertion failure from an invalid template instantiation pattern when adding instantiated params to the scope in friend functions with defaulted params (PR #113777)
Oleksandr T. via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 4 13:15:40 PST 2024
================
@@ -3437,10 +3437,10 @@ bool Sema::SubstDefaultArgument(
// template<typename T> void f(T a, int = decltype(a)());
// void g() { f(0); }
LIS = std::make_unique<LocalInstantiationScope>(*this);
- FunctionDecl *PatternFD = FD->getTemplateInstantiationPattern(
- /*ForDefinition*/ false);
- if (addInstantiatedParametersToScope(FD, PatternFD, *LIS, TemplateArgs))
- return true;
+ if (FunctionDecl *PatternFD =
+ FD->getTemplateInstantiationPattern(/*ForDefinition*/ false))
+ if (addInstantiatedParametersToScope(FD, PatternFD, *LIS, TemplateArgs))
+ return true;
----------------
a-tarasyuk wrote:
@zyn0217 whenever you get a chance, could you take a look at the latest changes? thanks
https://github.com/llvm/llvm-project/pull/113777
More information about the cfe-commits
mailing list