From 1a78ae3c895d0520bbb8ad2f154e737d52fe7ae2 Mon Sep 17 00:00:00 2001 From: Eric Fiselier Date: Wed, 7 Feb 2018 23:50:25 +0000 Subject: Fix size and alignment of array. An array T[1] isn't necessarily the same say when it's a member of a struct. This patch addresses that problem and corrects the tests to deal with it. llvm-svn: 324545 --- libcxx/include/array | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libcxx/include/array') diff --git a/libcxx/include/array b/libcxx/include/array index 706e573dbed..fdb1f9dae53 100644 --- a/libcxx/include/array +++ b/libcxx/include/array @@ -244,10 +244,11 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0> typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - typedef typename conditional::value, const char, char>::type _CharType; - _ALIGNAS(alignment_of<_Tp[1]>::value) _CharType __elems_[sizeof(_Tp[1])]; + + struct _ArrayInStructT { _Tp __data_[1]; }; + _ALIGNAS_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)]; // No explicit construct/copy/destroy for aggregate type _LIBCPP_INLINE_VISIBILITY void fill(const value_type&) { -- cgit v1.2.3