summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xclang/lib/Sema/SemaTemplateInstantiateDecl.cpp6
-rw-r--r--clang/test/SemaTemplate/instantiate-requires-clause.cpp10
2 files changed, 13 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index a470cfc8744..7d60298be2b 100755
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -4242,9 +4242,9 @@ bool Sema::CheckInstantiatedFunctionTemplateConstraints(
MLTAL.getInnermost(), SourceRange());
if (Inst.isInvalid())
return true;
- if (addInstantiatedParametersToScope(*this, Decl,
- Decl->getTemplateInstantiationPattern(),
- Scope, MLTAL))
+ if (addInstantiatedParametersToScope(
+ *this, Decl, Decl->getPrimaryTemplate()->getTemplatedDecl(),
+ Scope, MLTAL))
return true;
}
diff --git a/clang/test/SemaTemplate/instantiate-requires-clause.cpp b/clang/test/SemaTemplate/instantiate-requires-clause.cpp
index f36396b98db..04b595717e6 100644
--- a/clang/test/SemaTemplate/instantiate-requires-clause.cpp
+++ b/clang/test/SemaTemplate/instantiate-requires-clause.cpp
@@ -29,3 +29,13 @@ using f31 = decltype(f3('a'));
using f32 = decltype(f3(1, 'b'));
using f33 = decltype(f3(1, 'b', 2));
// expected-error@-1 {{no matching function for call to 'f3'}}
+
+template<typename T>
+struct S {
+ template<typename U>
+ static constexpr auto f(U const index) requires(index, true) {
+ return true;
+ }
+};
+
+static_assert(S<void>::f(1));
OpenPOWER on IntegriCloud