Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

Dtor is already of CXXDestructorDecl *.

Dtor is already of CXXDestructorDecl *.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Jul 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 13, 2025

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

Dtor is already of CXXDestructorDecl *.


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

1 Files Affected:

  • (modified) clang/lib/Sema/SemaExprCXX.cpp (+1-2)
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 2ad0fd1a81a47..25afa2f4dfe7a 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -4096,8 +4096,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
       if (!PointeeRD->hasIrrelevantDestructor()) {
         if (CXXDestructorDecl *Dtor = LookupDestructor(PointeeRD)) {
           if (Dtor->isCalledByDelete(OperatorDelete)) {
-            MarkFunctionReferenced(StartLoc,
-                                   const_cast<CXXDestructorDecl *>(Dtor));
+            MarkFunctionReferenced(StartLoc, Dtor);
             if (DiagnoseUseOfDecl(Dtor, StartLoc))
               return ExprError();
           }

@kazutakahirata kazutakahirata merged commit 0475526 into llvm:main Jul 13, 2025
12 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250713_cast_clang_Sema branch July 13, 2025 20:12
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" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants