================ @@ -6481,6 +6481,33 @@ void Sema::PerformPendingInstantiations(bool LocalOnly) { PendingInstantiations.swap(delayedPCHInstantiations); } +// Instantiate all referenced specializations of the given function template +// definition. This make sure that function template that are defined after the +// point of instantiation of their used can be evaluated after they are defined. +// see CWG2497. +void Sema::InstantiateFunctionTemplateSpecializations( + SourceLocation PointOfInstantiation, FunctionDecl *Tpl) { + + auto InstantiateAll = [&](const auto &Range) { + for (NamedDecl *Fun : Range) { + InstantiateFunctionDefinition(PointOfInstantiation, ---------------- zygoloid wrote:
I think the point of instantiation should be read from the FunctionDecl, not the point where the function is defined, so that the "in instantiation of" note points to the right place. https://github.com/llvm/llvm-project/pull/73463 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits