[libcxx-commits] [PATCH] D80452: [libc++] Complete overhaul of constexpr support in std::array
Leonard Chan via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri May 29 16:25:08 PDT 2020
leonardchan added a comment.
In D80452#2064445 <https://reviews.llvm.org/D80452#2064445>, @leonardchan wrote:
> Hi! I think this patch might be the cause of the bug at https://bugs.llvm.org/show_bug.cgi?id=46137.
>
> Essentially, we get an error when attempting to create `std::array<S, 0>` if S has a non-trivial destructor (full example at the bug link):
>
> test.cc:20:20: error: call to implicitly-deleted default constructor of 'std::array<S, 0>'
> std::array<S, 0> x; // bad
> ^
> /usr/local/google/home/leonardchan/llvm-monorepo/llvm-build-1-master-fuchsia-toolchain/install/bin/../include/c++/v1/array:252:7: note: default constructor of 'array<S, 0>' is implicitly deleted because field '__w' has a deleted destructor
> } __w;
> ^
> /usr/local/google/home/leonardchan/llvm-monorepo/llvm-build-1-master-fuchsia-toolchain/install/bin/../include/c++/v1/array:248:9: note: explicitly defaulted function was implicitly deleted here
> ~__wrapper() = default;
> ^
> /usr/local/google/home/leonardchan/llvm-monorepo/llvm-build-1-master-fuchsia-toolchain/install/bin/../include/c++/v1/array:251:13: note: destructor of '__wrapper' is implicitly deleted because variant field '__t' has a non-trivial destructor
> _Tp __t;
> ^
> test.cc:20:20: error: attempt to use a deleted function
> std::array<S, 0> x; // bad
> ^
>
>
> I believe std::arrays of size 0 should be legal regardless of constraints on the element type.
Woops. Sorry. Disregard my comment. Didn't refresh and see @MaskRay's comment or D80821 <https://reviews.llvm.org/D80821>. Thanks for the fix!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D80452/new/
https://reviews.llvm.org/D80452
More information about the libcxx-commits
mailing list