Skip to content

Commit

Permalink
[Clang] Fix an assertion failure introduced by #93430 (#100313)
Browse files Browse the repository at this point in the history
Summary:
The PR #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.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250628
  • Loading branch information
cor3ntin authored and yuxuanchen1997 committed Jul 25, 2024
1 parent 82de560 commit e861559
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 e861559

Please sign in to comment.