C++ Logo

std-proposals

Advanced search

Re: [std-proposals] In re: Issue2157

From: Jens Maurer <jens.maurer_at_[hidden]>
Date: Fri, 8 Dec 2023 22:04:22 +0100
On 08/12/2023 00.27, Arthur O'Dwyer wrote:
> On Thu, Dec 7, 2023 at 2:00 AM Jens Maurer <jens.maurer_at_[hidden] <mailto:jens.maurer_at_[hidden]>> wrote:

> A consistency point of view:
> T * p = new T[n];
> (where n might be a constant or not)
> is now required to have T default constructible even if n = 0. CWG 2102 <https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#2102>.
>
>
> That's a different (and perhaps even deeper) can of worms, right?

Sure, but it's also about empty arrays.

Jens


> We currently lack specification for whether any of these expressions are supposed to work:
> std::array<const int, 0> ca = {}; // OK
> std::array<const int, 0> cb; // unclear; libc++ and *Microsoft* reject; *libstdc++* accepts
> ca = ca; // unclear; libc++ and Microsoft reject; libstdc++ accepts
> ca.fill(42); // unclear; libc++ and *libstdc++* reject; *Microsoft* accepts
> ca.swap(ca); // unclear; libc++ and libstdc++ reject; Microsoft accepts
> Is there yet an LWG issue to clarify the well-formedness of the "mutating" member functions of array<const T, N>?
>
> Thanks,
> Arthur

Received on 2023-12-08 21:04:26