forked from OSchip/llvm-project
[Concepts] Fix incorrect TemplateArgs for introduction of local parameters
The wrong set of TemplateArgs was being provided to addInstantiatedParametersToScope. Caused bug #44658.
This commit is contained in:
parent
29e411b3d6
commit
9c24fca2a3
|
@ -4246,18 +4246,17 @@ bool Sema::CheckInstantiatedFunctionTemplateConstraints(
|
|||
Sema::ContextRAII savedContext(*this, Decl);
|
||||
LocalInstantiationScope Scope(*this);
|
||||
|
||||
MultiLevelTemplateArgumentList MLTAL =
|
||||
getTemplateInstantiationArgs(Decl, nullptr, /*RelativeToPrimary*/true);
|
||||
|
||||
// If this is not an explicit specialization - we need to get the instantiated
|
||||
// version of the template arguments and add them to scope for the
|
||||
// substitution.
|
||||
if (Decl->isTemplateInstantiation()) {
|
||||
InstantiatingTemplate Inst(*this, Decl->getPointOfInstantiation(),
|
||||
InstantiatingTemplate::ConstraintsCheck{}, Decl->getPrimaryTemplate(),
|
||||
MLTAL.getInnermost(), SourceRange());
|
||||
TemplateArgs, SourceRange());
|
||||
if (Inst.isInvalid())
|
||||
return true;
|
||||
MultiLevelTemplateArgumentList MLTAL(
|
||||
*Decl->getTemplateSpecializationArgs());
|
||||
if (addInstantiatedParametersToScope(
|
||||
*this, Decl, Decl->getPrimaryTemplate()->getTemplatedDecl(),
|
||||
Scope, MLTAL))
|
||||
|
|
|
@ -51,3 +51,10 @@ struct S2 {
|
|||
|
||||
static_assert((S2<int>::f(), true));
|
||||
|
||||
template<typename T>
|
||||
struct S3 {
|
||||
template<typename... Args> requires true
|
||||
static constexpr void f(Args...) { }
|
||||
};
|
||||
|
||||
static_assert((S3<int>::f(), true));
|
Loading…
Reference in New Issue