[clang] Fix assertion failure during conversion function overload resolution. (PR #98671)

Daniel M. Katz via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 19 10:57:02 PDT 2024


================
@@ -1519,7 +1519,8 @@ bool Sema::IsAtLeastAsConstrained(NamedDecl *D1,
     auto IsExpectedEntity = [](const FunctionDecl *FD) {
       FunctionDecl::TemplatedKind Kind = FD->getTemplatedKind();
       return Kind == FunctionDecl::TK_NonTemplate ||
-             Kind == FunctionDecl::TK_FunctionTemplate;
----------------
katzdm wrote:

@shafik Thanks for taking a look here.

@chaoren Looking at this a bit more closely, I think the suggested removal of `TK_FunctionTemplate` may be incorrect. The affected `Sema::IsAtLeastAsConstrained` function is leveraged by three functions in `SemaTemplateDeduction.cpp`:
- `Sema::getMoreSpecializedTemplate`
- `Sema::getMoreConstrainedFunction`
- `Sema::getMoreSpecialized`

The first of these, `Sema::getMoreSpecializedTemplate`, checks the "constrained-ness" of the templated `FunctionDecl`s associated with two `FunctionTemplateDecl`s. I believe the removed `TK_FunctionTemplate` case would apply here. I'll work backwards from there to see if I can produce a failing test case.

https://github.com/llvm/llvm-project/pull/98671


More information about the cfe-commits mailing list