[libcxx-commits] [PATCH] D120633: [libc++] Better handling for zero-sized types
Casey Carter via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 28 12:31:26 PST 2022
CaseyCarter added inline comments.
================
Comment at: libcxx/test/std/ranges/range.access/begin.sizezero.pass.cpp:23
+};
+static_assert(sizeof(A) == 0); // an extension supported by GCC and Clang
+
----------------
Quuxplusone wrote:
> Mordante wrote:
> > I think it would be better to move this comment to line 11 to describe what the test is about.
> >
> > Let's make sure the test also works on MSVC, where the size is 4. That will probably make @CaseyCarter happy.
> Sure, I can say something like
> ```
> // std::ranges::begin
> // std::ranges::cbegin
> // Test an element type that is complete, yet has size zero.
> ```
> I definitely //don't// want this test to silently compile when `sizeof(A) > 0`, because then someone might accidentally change `m`'s declaration so that `sizeof(A) > 0` on GCC and Clang, and then it would be silently nerfed. I don't object to adding `XFAIL: msvc`, though. And if @CaseyCarter knows a way to achieve `sizeof(A) == 0` on MSVC, that'd be even better!
Arrays of size-zero elements are anathema. Feel free to `XFAIL: msvc` or `UNSUPPORTED: msvc` this test as you like =)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D120633/new/
https://reviews.llvm.org/D120633
More information about the libcxx-commits
mailing list