Skip to content

Commit

Permalink
[Clang] Fix an assertion failure introduced by llvm#93430 (llvm#100313)
Browse files Browse the repository at this point in the history
The PR llvm#93430 introduced an assertion that did not make any sense. and
caused a regression. The fix is to simply remove the assertion.

No changelog. the intent is to backport this fix to clang 19.

(cherry picked from commit dd82a84)
  • Loading branch information
cor3ntin authored and tru committed Jul 26, 2024
1 parent c5f3487 commit 07e9f01
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion clang/lib/Sema/SemaExpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5730,7 +5730,6 @@ static bool isParenthetizedAndQualifiedAddressOfExpr(Expr *Fn) {
if (!UO || UO->getOpcode() != clang::UO_AddrOf)
return false;
if (auto *DRE = dyn_cast<DeclRefExpr>(UO->getSubExpr()->IgnoreParens())) {
assert(isa<FunctionDecl>(DRE->getDecl()) && "expected a function");
return DRE->hasQualifier();
}
if (auto *OVL = dyn_cast<OverloadExpr>(UO->getSubExpr()->IgnoreParens()))
Expand Down
6 changes: 6 additions & 0 deletions clang/test/SemaCXX/cxx2b-deducing-this.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,10 @@ void g() {
}

namespace P2797 {

int bar(void) { return 55; }
int (&fref)(void) = bar;

struct C {
void c(this const C&); // #first
void c() &; // #second
Expand All @@ -915,6 +919,8 @@ struct C {
(&C::c)(C{});
(&C::c)(*this); // expected-error {{call to non-static member function without an object argument}}
(&C::c)();

(&fref)();
}
};
}
Expand Down

0 comments on commit 07e9f01

Please sign in to comment.