[libcxx-commits] [libcxx] [libc++] Fix constexpr initialization of std::array<T, 0> (PR #74667)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 14 14:15:51 PST 2023


EricWF wrote:

Hmm, So I see we already migrated away from  not returning `nullptr` from `array<T, 0>`. My understanding was that was explicitly prohibited by the standard when it says 

[2](https://eel.is/c++draft/sequences#array.zero-2)
[#](http://github.com/Eelis/draft/tree/180690ab2654988b5d40bfe2f50b32737f02f20b/source/containers.tex#L6391)
In the case that N == 0, begin() == end() == unique value[.](https://eel.is/c++draft/sequences#array.zero-2.sentence-1) The return value of data() is unspecified[.](https://eel.is/c++draft/sequences#array.zero-2.sentence-2)

The "unique" bit specifically saying that the two arrays can't both return nullptr.

I think we may have strayed from the right implementation here, and done it a while ago. I would like to consider this more.

https://github.com/llvm/llvm-project/pull/74667


More information about the libcxx-commits mailing list