================ @@ -4120,6 +4121,28 @@ TemplateDeductionResult Sema::FinishTemplateArgumentDeduction( } } + // If the template is an operator function template, check that the + // resulting specialization is a valid operator function. + switch (Specialization->getOverloadedOperator()) { + case OO_None: + case OO_New: + case OO_Array_New: + case OO_Delete: + case OO_Array_Delete: + break; + + default: + // SFINAE does not apply at this point in the instantiation process. + // Push a new CodeSynthesisContext to briefly re-enable it here. + InstantiatingTemplate Inst( + *this, Info.getLocation(), FunctionTemplate, DeducedArgs, + CodeSynthesisContext::DeducedTemplateArgumentSubstitution, Info); + if (Inst.isInvalid()) + return TemplateDeductionResult::InstantiationDepth; + if (CheckOverloadedOperatorParams(Specialization)) + return TemplateDeductionResult::SubstitutionFailure; ---------------- offsetof wrote:
Sure. Added a comment with the reference. https://github.com/llvm/llvm-project/pull/131777 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits