[all-commits] [llvm/llvm-project] 7265ff: [libc++] Fix issues with the triviality of std::array

Louis Dionne via All-commits all-commits at lists.llvm.org
Fri May 29 16:35:01 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 7265ff928a974a844b6301c139cbb0f957532da9
      https://github.com/llvm/llvm-project/commit/7265ff928a974a844b6301c139cbb0f957532da9
  Author: Louis Dionne <ldionne at apple.com>
  Date:   2020-05-29 (Fri, 29 May 2020)

  Changed paths:
    M libcxx/include/array
    A libcxx/test/libcxx/containers/sequences/array/triviality.pass.cpp
    M libcxx/test/std/containers/sequences/array/aggregate.pass.cpp
    R libcxx/test/std/containers/sequences/array/array.cons/default.pass.cpp
    M libcxx/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp
    A libcxx/test/std/containers/sequences/array/array.cons/initialization.pass.cpp
    R libcxx/test/std/containers/sequences/array/array.cons/initializer_list.pass.cpp
    M libcxx/test/std/containers/sequences/array/array.data/data.pass.cpp
    M libcxx/test/std/containers/sequences/array/array.data/data_const.pass.cpp
    M libcxx/test/std/containers/sequences/array/iterators.pass.cpp

  Log Message:
  -----------
  [libc++] Fix issues with the triviality of std::array

The Standard is currently unimplementable. We have to pick between:

1. Not implementing constexpr support properly in std::array<T, 0>
2. Making std::array<T, 0> non-trivial even when T is trivial
3. Returning nullptr from std::array<T, 0>::begin()

Libc++ initially picked (1). In 77b9abfc8e89, we started implementing constexpr properly, but lost the guarantee of triviality. Since it seems like both (1) and (2) are really important, it seems like (3) is the only viable option for libc++, after all. This is also what other implementations are doing.

This patch moves libc++ from (1) to (3).

It also:
- Improves the test coverage for the various ways of initializing std::array
- Adds tests for the triviality of std::array
- Adds tests for the aggregate-ness of std::array

Reviewed By: #libc, miscco, EricWF, zoecarver

Differential Revision: https://reviews.llvm.org/D80821




More information about the All-commits mailing list