[PATCH] D76219: [Sema][SVE] Reject "delete" with sizeless types
Richard Sandiford via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 17 06:18:20 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4ece6f051bd0: [Sema][SVE] Reject "delete" with sizeless types (authored by rsandifo-arm).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76219/new/
https://reviews.llvm.org/D76219
Files:
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/sizeless-1.cpp
Index: clang/test/SemaCXX/sizeless-1.cpp
===================================================================
--- clang/test/SemaCXX/sizeless-1.cpp
+++ clang/test/SemaCXX/sizeless-1.cpp
@@ -420,6 +420,9 @@
new (global_int8_ptr) svint8_t(); // expected-error {{allocation of sizeless type 'svint8_t'}}
new (global_int8_ptr) svint8_t[10]; // expected-error {{allocation of sizeless type 'svint8_t'}}
+ delete global_int8_ptr; // expected-error {{cannot delete expression of type 'svint8_t *'}}
+ delete[] global_int8_ptr; // expected-error {{cannot delete expression of type 'svint8_t *'}}
+
local_int8.~__SVInt8_t(); // expected-error {{object expression of non-scalar type 'svint8_t' (aka '__SVInt8_t') cannot be used in a pseudo-destructor expression}}
(void)svint8_t();
Index: clang/lib/Sema/SemaExprCXX.cpp
===================================================================
--- clang/lib/Sema/SemaExprCXX.cpp
+++ clang/lib/Sema/SemaExprCXX.cpp
@@ -3467,7 +3467,8 @@
// this, so we treat it as a warning unless we're in a SFINAE context.
Diag(StartLoc, diag::ext_delete_void_ptr_operand)
<< Type << Ex.get()->getSourceRange();
- } else if (Pointee->isFunctionType() || Pointee->isVoidType()) {
+ } else if (Pointee->isFunctionType() || Pointee->isVoidType() ||
+ Pointee->isSizelessType()) {
return ExprError(Diag(StartLoc, diag::err_delete_operand)
<< Type << Ex.get()->getSourceRange());
} else if (!Pointee->isDependentType()) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76219.250746.patch
Type: text/x-patch
Size: 1520 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200317/2a1f7786/attachment.bin>
More information about the cfe-commits
mailing list