[clang] [clang-tools-extra] [clangd] Fixed signature help for static call operator (C++23) (PR #199192)
via cfe-commits
cfe-commits at lists.llvm.org
Sun May 24 14:17:19 PDT 2026
================
@@ -7869,9 +7869,10 @@ void Sema::AddFunctionCandidates(const UnresolvedSetImpl &Fns,
// Slice the first argument (which is the base) when we access
// static method as non-static.
if (Args.size() > 0 &&
- (!Args[0] || (FirstArgumentIsBase && isa<CXXMethodDecl>(FD) &&
- !isa<CXXConstructorDecl>(FD)))) {
- assert(cast<CXXMethodDecl>(FD)->isStatic());
+ (!Args[0] ||
+ (isa<CXXMethodDecl>(FD) && !isa<CXXConstructorDecl>(FD) &&
+ (FirstArgumentIsBase || cast<CXXMethodDecl>(FD)->isStatic())))) {
+ assert(FirstArgumentIsBase || cast<CXXMethodDecl>(FD)->isStatic());
----------------
timon-ul wrote:
This assert is pretty pointless, you can only enter this branch if either `FirstArgumentIsBase || cast<CXXMethodDecl>(FD)->isStatic()` so of course this will hold. As far as I can tell the old assert logic was that if `FirstArgumentIsBase == true` it had to be a static function, but without explicitly testing for it this assert made sure that it is the case. Now with your new assert this could not be true and slip by this assert now.
https://github.com/llvm/llvm-project/pull/199192
More information about the cfe-commits
mailing list