llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Oleksandr T. (a-tarasyuk) <details> <summary>Changes</summary> Fixes #<!-- -->96191 --- Full diff: https://github.com/llvm/llvm-project/pull/99308.diff 3 Files Affected: - (modified) clang/docs/ReleaseNotes.rst (+1) - (modified) clang/lib/Sema/SemaExprCXX.cpp (+3) - (modified) clang/test/SemaCXX/cxx2a-destroying-delete.cpp (+9) ``````````diff diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 6dc45956a9afb..ed99f3796ad34 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -1043,6 +1043,7 @@ Bug Fixes to C++ Support - Clang now diagnoses explicit object parameters in member pointers and other contexts where they should not appear. Fixes (#GH85992). - Fixed a crash-on-invalid bug involving extraneous template parameter with concept substitution. (#GH73885) +- Fixed a failed assertion when checking invalid delete operator declaration (GH96191). Bug Fixes to AST Handling ^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index bef7da239e6e5..c581a3448e927 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -3806,6 +3806,9 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, Overaligned, DeleteName); } + if (OperatorDelete->isInvalidDecl()) + return ExprError(); + MarkFunctionReferenced(StartLoc, OperatorDelete); // Check access and ambiguity of destructor if we're going to call it. diff --git a/clang/test/SemaCXX/cxx2a-destroying-delete.cpp b/clang/test/SemaCXX/cxx2a-destroying-delete.cpp index 349e6e9538a4c..25b985ef11d15 100644 --- a/clang/test/SemaCXX/cxx2a-destroying-delete.cpp +++ b/clang/test/SemaCXX/cxx2a-destroying-delete.cpp @@ -187,3 +187,12 @@ namespace delete_from_new { #endif } } + +namespace GH96191 { + struct S {}; + struct T { + void operator delete(S) { } // expected-error {{first parameter of 'operator delete' must have type 'void *'}} + }; + + void foo(T *t) { delete t; } +} `````````` </details> https://github.com/llvm/llvm-project/pull/99308 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits