1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
15 #include <cstddef> // for std::max_align_t
17 #include "test_macros.h"
19 // std::array is explicitly allowed to be initialized with A a = { init-list };.
20 // Disable the missing braces warning for this reason.
21 #include "disable_missing_braces_warning.h"
32 typedef std::array
<T
, 3> C
;
41 typedef std::array
<T
, 0> C
;
44 LIBCPP_ASSERT(p
!= nullptr);
48 typedef std::array
<const T
, 0> C
;
50 const T
* p
= c
.data();
51 static_assert((std::is_same
<decltype(c
.data()), const T
*>::value
), "");
52 LIBCPP_ASSERT(p
!= nullptr);
55 typedef std::max_align_t T
;
56 typedef std::array
<T
, 0> C
;
58 const T
* p
= c
.data();
59 LIBCPP_ASSERT(p
!= nullptr);
60 std::uintptr_t pint
= reinterpret_cast<std::uintptr_t>(p
);
61 assert(pint
% TEST_ALIGNOF(std::max_align_t
) == 0);
65 typedef std::array
<T
, 0> C
;
68 LIBCPP_ASSERT(p
!= nullptr);