Skip to content

Commit 0320d20

Browse files
authored
Revert "[Clang] Deleting an incomplete enum type is not an error (#118455)"
This reverts commit 8271195.
1 parent 92376c3 commit 0320d20

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,6 @@ Bug Fixes to C++ Support
796796
- Fixed an assertion failure caused by mangled names with invalid identifiers. (#GH112205)
797797
- Fixed an incorrect lambda scope of generic lambdas that caused Clang to crash when computing potential lambda
798798
captures at the end of a full expression. (#GH115931)
799-
- Clang no longer rejects deleting a pointer of incomplete enumeration type. (#GH99278)
800799

801800
Bug Fixes to AST Handling
802801
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/SemaExprCXX.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,8 +3747,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
37473747
} else if (!Pointee->isDependentType()) {
37483748
// FIXME: This can result in errors if the definition was imported from a
37493749
// module but is hidden.
3750-
if (!Pointee->isStructureOrClassType() ||
3751-
!RequireCompleteType(StartLoc, Pointee,
3750+
if (!RequireCompleteType(StartLoc, Pointee,
37523751
LangOpts.CPlusPlus26
37533752
? diag::err_delete_incomplete
37543753
: diag::warn_delete_incomplete,

clang/test/SemaCXX/new-delete.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -540,13 +540,6 @@ namespace PR10504 {
540540
void f(A *x) { delete x; } // expected-warning {{delete called on 'PR10504::A' that is abstract but has non-virtual destructor}}
541541
}
542542

543-
#if __cplusplus >= 201103L
544-
enum GH99278_1 {
545-
zero = decltype(delete static_cast<GH99278_1*>(nullptr), 0){}
546-
// expected-warning@-1 {{expression with side effects has no effect in an unevaluated context}}
547-
};
548-
#endif
549-
550543
struct PlacementArg {};
551544
inline void *operator new[](size_t, const PlacementArg &) throw () {
552545
return 0;

0 commit comments

Comments
 (0)