[libcxx-commits] [PATCH] D120633: [libc++] Better handling for zero-sized types
Arthur O'Dwyer via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Feb 27 11:30:49 PST 2022
Quuxplusone added inline comments.
================
Comment at: libcxx/include/__memory/unique_ptr.h:78
operator()(_Up* __ptr) const _NOEXCEPT {
- static_assert(sizeof(_Tp) > 0,
- "default_delete can not delete incomplete type");
- static_assert(!is_void<_Tp>::value,
- "default_delete can not delete void type");
+ static_assert(sizeof(_Up) >= 0, "cannot delete an incomplete type");
delete[] __ptr;
----------------
My substitution of `_Up` for `_Tp` here was accidental, but it turns out to be a bugfix: https://eel.is/c++draft/smartptr#unique.ptr.dltr.dflt1-4
I'm not sure the difference is detectable, though; I can't think of any situation where `U(*)[]` is convertible to `T(*)[]` and yet `T`'s completeness is different from `U`'s.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120633/new/
https://reviews.llvm.org/D120633
More information about the libcxx-commits
mailing list