summaryrefslogtreecommitdiffstats
path: root/libcxx
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-06-04 16:25:58 +0000
committerNico Weber <nicolasweber@gmx.de>2014-06-04 16:25:58 +0000
commit7babe4f074675a7ba21f1feb1cbfd41193948293 (patch)
treeba5a4a7153dd449879e1e2907279ebebe3bf4ffd /libcxx
parent72e9a25c76de87cf7b4ba4431c7321bf4933a630 (diff)
downloadbcm5719-llvm-7babe4f074675a7ba21f1feb1cbfd41193948293.tar.gz
bcm5719-llvm-7babe4f074675a7ba21f1feb1cbfd41193948293.zip
Make meta.trans.other/aligned_storage.pass.cpp pass on arm.
The maximum alignment on arm is 8, not 16 like on x86. Use alignof(max_align_t) to make the test work in both cases. llvm-svn: 210195
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
index d1b77004f37..c87e99c46e8 100644
--- a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
+++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp
@@ -159,12 +159,19 @@ int main()
static_assert(std::alignment_of<T1>::value == 8, "");
static_assert(sizeof(T1) == 16, "");
}
+ // Use alignof(std::max_align_t) below to find the max alignment instead of
+ // hardcoding it, because it's different on different platforms.
+ // (For example 8 on arm and 16 on x86.)
+#if __cplusplus < 201103L
+#define alignof __alignof__
+#endif
{
typedef std::aligned_storage<16>::type T1;
#if _LIBCPP_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<16>, T1>::value, "" );
#endif
- static_assert(std::alignment_of<T1>::value == 16, "");
+ static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
+ "");
static_assert(sizeof(T1) == 16, "");
}
{
@@ -172,8 +179,9 @@ int main()
#if _LIBCPP_STD_VER > 11
static_assert(std::is_same<std::aligned_storage_t<17>, T1>::value, "" );
#endif
- static_assert(std::alignment_of<T1>::value == 16, "");
- static_assert(sizeof(T1) == 32, "");
+ static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t),
+ "");
+ static_assert(sizeof(T1) == 16 + alignof(std::max_align_t), "");
}
{
typedef std::aligned_storage<10>::type T1;
OpenPOWER on IntegriCloud