[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 10:00:05 PST 2022


Quuxplusone created this revision.
Quuxplusone added reviewers: ldionne, Mordante, philnik, var-const, jloser, libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

Zero-sized types are a GCC extension, also supported by Clang.

There's no particular reason for the removed static_asserts; it's already invalid to `delete` a void pointer or a pointer-to-incomplete, so we don't need any special code to catch those cases.

In ranges::begin/end, check `sizeof >= 0` instead of `sizeof != 0`, so as to permit zero-sized types while still disallowing incomplete types.

Fixes https://github.com/llvm/llvm-project/issues/54100


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120633

Files:
  libcxx/include/__memory/unique_ptr.h
  libcxx/include/__ranges/access.h
  libcxx/test/std/ranges/range.access/begin.sizezero.pass.cpp
  libcxx/test/std/ranges/range.access/end.sizezero.pass.cpp
  libcxx/test/std/utilities/smartptr/unique.ptr/unique.ptr.create/make_unique.sizezero.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120633.411691.patch
Type: text/x-patch
Size: 5438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220227/738485f9/attachment.bin>


More information about the libcxx-commits mailing list