[clang] [Clang][Sema] Avoid crash in overload diagnostics for invalid static deducing-this (PR #177783)

Luohao Wang via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 25 18:47:28 PST 2026


================
@@ -11874,7 +11874,7 @@ static void DiagnoseBadConversion(Sema &S, OverloadCandidate *Cand,
       !isa<CXXConstructorDecl>(Fn)) {
     if (I == 0)
       isObjectArgument = true;
-    else if (!Fn->hasCXXExplicitFunctionObjectParameter())
+    else if (!cast<CXXMethodDecl>(Fn)->isExplicitObjectMemberFunction())
----------------
Luohaothu wrote:

`isExplicitObjectMemberFunction` exceptionally requires the method to be non-static.
https://github.com/llvm/llvm-project/blob/2c7cf896be28febcd2f9af1b0dfdb5dfc6b97583/clang/lib/AST/DeclCXX.cpp#L2703-L2708

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


More information about the cfe-commits mailing list