================ @@ -3430,15 +3430,17 @@ bool Sema::SubstDefaultArgument( ContextRAII SavedContext(*this, FD); std::unique_ptr<LocalInstantiationScope> LIS; - if (ForCallExpr) { + FunctionDecl *PatternFD = + ForCallExpr + ? FD->getTemplateInstantiationPattern(/*ForDefinition*/ false) + : nullptr; + if (PatternFD) { // When instantiating a default argument due to use in a call expression, // an instantiation scope that includes the parameters of the callee is // required to satisfy references from the default argument. For example: // 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); ---------------- a-tarasyuk wrote:
@zyn0217 @mizvekov I've moved the condition to `InstantiateDefaultArgument` and added an additional test. Do the recent updates look acceptable? https://github.com/llvm/llvm-project/pull/113777 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits