C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Proposed defect report related to std::array<T, 0>

From: Ryan Nicholl <rnicholl_at_[hidden]>
Date: Fri, 15 Dec 2023 21:55:31 -0800
With regard to this note:

There is a single element of the aggregate, of an unspecified empty
aggregate type.

I believe that resolution is unsatisfactory as it would be a forced abi
break for libc++.

What is the chance a fix can be retroactively applied to C++17? I am not
sure what is the process for a defect report and how it differs from
regular proposals.

On Fri, Dec 15, 2023, 3:37 PM Jonathan Wakely <cxx_at_[hidden]> wrote:

>
>
> On Fri, 15 Dec 2023 at 21:56, Ryan Nicholl via Std-Proposals <
> std-proposals_at_[hidden]> wrote:
>
>> I would like to semi-formally propose a defect report related to
>> std::array and existing standards.
>>
>> It turns out std::array<T, 0> cannot be implemented in C++17 without the
>> use of magic compiler builtins. libc++, libstdc++, and I think also MSVC
>> are all non-compliant.
>>
>> Begin and end are required to return a unique pointer, the only constexpr
>> method I have found to do this is taking the address of a union member.
>> However, that approach breaks if T is non-trivial.
>>
>
> This is https://cplusplus.github.io/LWG/issue2157
>
>
>> Glibc libstdc++ libc++ ignores the standard requirement of uniqueness in
>> favor of following the trivial and constexpr requirements. Both of these
>> implementations return nullptr.
>>
>
> N.B. There's no such thing as Glibc libstdc++. Libstdc++ is part of GCC,
> which is a completely separate project from Glibc.
>
>
>

Received on 2023-12-16 05:55:42