This is a regression from
6db007a0 that was reported in:
https://github.com/llvm/llvm-project/issues/62697
The assertion was because we require a code synthesis context for the
instantiation of templates, and this reproducer causes a comparison that
doesn't have a parent-template causing one to exists.
This patch fixes it by creating a ConstraintNormalization context.
return ConstrExpr;
Sema::SFINAETrap SFINAE(S, /*AccessCheckingSFINAE=*/false);
+
+ Sema::InstantiatingTemplate Inst(
+ S, ND->getLocation(),
+ Sema::InstantiatingTemplate::ConstraintNormalization{},
+ const_cast<NamedDecl *>(ND), SourceRange{});
+
+ if (Inst.isInvalid())
+ return nullptr;
+
std::optional<Sema::CXXThisScopeRAII> ThisScope;
if (auto *RD = dyn_cast<CXXRecordDecl>(ND->getDeclContext()))
ThisScope.emplace(S, const_cast<CXXRecordDecl *>(RD), Qualifiers());
} // namespace three_level
} // namespace MultilevelTemplateWithPartialSpecialization
+
+namespace PR62697 {
+template<typename>
+concept c = true;
+
+template<typename T>
+struct s {
+ void f() requires c<void(T)>;
+};
+
+template<typename T>
+void s<T>::f() requires c<void(T)> { }
+}