[llvm-branch-commits] [clang] 0320d20 - Revert "[Clang] Deleting an incomplete enum type is not an error (#118455)"
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Dec 6 06:16:37 PST 2024
Author: cor3ntin
Date: 2024-12-06T15:16:34+01:00
New Revision: 0320d20dbdcafec2a090006c9674f642e207db27
URL: https://github.com/llvm/llvm-project/commit/0320d20dbdcafec2a090006c9674f642e207db27
DIFF: https://github.com/llvm/llvm-project/commit/0320d20dbdcafec2a090006c9674f642e207db27.diff
LOG: Revert "[Clang] Deleting an incomplete enum type is not an error (#118455)"
This reverts commit 8271195de05742ed7079d7882fbebc2daecbd7e2.
Added:
Modified:
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/new-delete.cpp
Removed:
################################################################################
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3f58e64cf0ccbc..59e3a6609123d2 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -796,7 +796,6 @@ Bug Fixes to C++ Support
- Fixed an assertion failure caused by mangled names with invalid identifiers. (#GH112205)
- Fixed an incorrect lambda scope of generic lambdas that caused Clang to crash when computing potential lambda
captures at the end of a full expression. (#GH115931)
-- Clang no longer rejects deleting a pointer of incomplete enumeration type. (#GH99278)
Bug Fixes to AST Handling
^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index db9ea7fb66e05a..f58c0fa21e8380 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -3747,8 +3747,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
} else if (!Pointee->isDependentType()) {
// FIXME: This can result in errors if the definition was imported from a
// module but is hidden.
- if (!Pointee->isStructureOrClassType() ||
- !RequireCompleteType(StartLoc, Pointee,
+ if (!RequireCompleteType(StartLoc, Pointee,
LangOpts.CPlusPlus26
? diag::err_delete_incomplete
: diag::warn_delete_incomplete,
diff --git a/clang/test/SemaCXX/new-delete.cpp b/clang/test/SemaCXX/new-delete.cpp
index 98b168d9df1f37..595bdc689d694b 100644
--- a/clang/test/SemaCXX/new-delete.cpp
+++ b/clang/test/SemaCXX/new-delete.cpp
@@ -540,13 +540,6 @@ namespace PR10504 {
void f(A *x) { delete x; } // expected-warning {{delete called on 'PR10504::A' that is abstract but has non-virtual destructor}}
}
-#if __cplusplus >= 201103L
-enum GH99278_1 {
- zero = decltype(delete static_cast<GH99278_1*>(nullptr), 0){}
- // expected-warning at -1 {{expression with side effects has no effect in an unevaluated context}}
-};
-#endif
-
struct PlacementArg {};
inline void *operator new[](size_t, const PlacementArg &) throw () {
return 0;
More information about the llvm-branch-commits
mailing list