[PATCH] D61301: Support overaligned types in `aligned_storage`.
Eric Fiselier via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 30 11:42:38 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359596: Support overaligned types in `aligned_storage`. (authored by EricWF, committed by ).
Herald added subscribers: llvm-commits, christof.
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D61301?vs=197287&id=197390#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61301/new/
https://reviews.llvm.org/D61301
Files:
libcxx/trunk/include/type_traits
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
Index: libcxx/trunk/include/type_traits
===================================================================
--- libcxx/trunk/include/type_traits
+++ libcxx/trunk/include/type_traits
@@ -1768,6 +1768,9 @@
__nat
> > > > > > > > > > __all_types;
+template <size_t _Align>
+struct _ALIGNAS(_Align) __fallback_overaligned {};
+
template <class _TL, size_t _Align> struct __find_pod;
template <class _Hp, size_t _Align>
@@ -1776,7 +1779,7 @@
typedef typename conditional<
_Align == _Hp::value,
typename _Hp::type,
- void
+ __fallback_overaligned<_Align>
>::type type;
};
@@ -1813,7 +1816,6 @@
struct _LIBCPP_TEMPLATE_VIS aligned_storage
{
typedef typename __find_pod<__all_types, _Align>::type _Aligner;
- static_assert(!is_void<_Aligner>::value, "");
union type
{
_Aligner __align;
Index: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
===================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
@@ -285,6 +285,14 @@
static_assert(std::alignment_of<T1>::value == 8, "");
static_assert(sizeof(T1) == 16, "");
}
+ {
+ const int Align = 65536;
+ typedef typename std::aligned_storage<1, Align>::type T1;
+ static_assert(std::is_trivial<T1>::value, "");
+ static_assert(std::is_standard_layout<T1>::value, "");
+ static_assert(std::alignment_of<T1>::value == Align, "");
+ static_assert(sizeof(T1) == Align, "");
+ }
return 0;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61301.197390.patch
Type: text/x-patch
Size: 1795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190430/894dc39a/attachment.bin>
More information about the llvm-commits
mailing list