Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Clang] Fix an assertion failure introduced by #93430 #100313

Merged
merged 1 commit into from
Jul 24, 2024

Conversation

cor3ntin
Copy link
Contributor

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.

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.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 24, 2024
@cor3ntin cor3ntin added regression and removed clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 24, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 24, 2024

@llvm/pr-subscribers-clang

Author: cor3ntin (cor3ntin)

Changes

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.


Full diff: https://github.com/llvm/llvm-project/pull/100313.diff

2 Files Affected:

  • (modified) clang/lib/Sema/SemaExpr.cpp (-1)
  • (modified) clang/test/SemaCXX/cxx2b-deducing-this.cpp (+6)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 8d24e34520e77..0a65213b0af33 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5711,7 +5711,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()))
diff --git a/clang/test/SemaCXX/cxx2b-deducing-this.cpp b/clang/test/SemaCXX/cxx2b-deducing-this.cpp
index 5cbc1f735383b..4811b6052254c 100644
--- a/clang/test/SemaCXX/cxx2b-deducing-this.cpp
+++ b/clang/test/SemaCXX/cxx2b-deducing-this.cpp
@@ -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
@@ -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)();
   }
 };
 }

@cor3ntin cor3ntin added the clang:frontend Language frontend issues, e.g. anything involving "Sema" label Jul 24, 2024
Copy link
Contributor

@Sirraide Sirraide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cor3ntin cor3ntin merged commit dd82a84 into llvm:main Jul 24, 2024
12 checks passed
@cor3ntin cor3ntin added this to the LLVM 19.X Release milestone Jul 24, 2024
@cor3ntin
Copy link
Contributor Author

/cherry-pick dd82a84

llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 24, 2024
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)
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 24, 2024

/pull-request #100407

yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
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
tru pushed a commit to llvmbot/llvm-project that referenced this pull request Jul 26, 2024
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" regression
Projects
Development

Successfully merging this pull request may close these issues.

3 participants