summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp12
-rw-r--r--libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp65
-rw-r--r--libcxx/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp4
3 files changed, 73 insertions, 8 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 845c7620f10..323fd5e4cfb 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
@@ -92,17 +92,17 @@ int main()
}
{
typedef std::aligned_storage<8>::type T1;
- static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
+ static_assert(std::alignment_of<T1>::value == 8, "");
static_assert(sizeof(T1) == 8, "");
}
{
typedef std::aligned_storage<9>::type T1;
- static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
- static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), "");
+ static_assert(std::alignment_of<T1>::value == 8, "");
+ static_assert(sizeof(T1) == 16, "");
}
{
typedef std::aligned_storage<15>::type T1;
- static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
+ static_assert(std::alignment_of<T1>::value == 8, "");
static_assert(sizeof(T1) == 16, "");
}
{
@@ -117,7 +117,7 @@ int main()
}
{
typedef std::aligned_storage<10>::type T1;
- static_assert(std::alignment_of<T1>::value == (sizeof(long) == 4 ? 4 : 8), "");
- static_assert(sizeof(T1) == (sizeof(long) == 4 ? 12 : 16), "");
+ static_assert(std::alignment_of<T1>::value == 8, "");
+ static_assert(sizeof(T1) == 16, "");
}
}
diff --git a/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp
new file mode 100644
index 00000000000..b07a06479d6
--- /dev/null
+++ b/libcxx/test/utilities/meta/meta.trans/meta.trans.other/aligned_union.pass.cpp
@@ -0,0 +1,65 @@
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// type_traits
+
+// aligned_union<size_t Len, class ...Types>
+
+#include <type_traits>
+
+int main()
+{
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+ {
+ typedef std::aligned_union<10, char >::type T1;
+ static_assert(std::alignment_of<T1>::value == 1, "");
+ static_assert(sizeof(T1) == 10, "");
+ }
+ {
+ typedef std::aligned_union<10, short >::type T1;
+ static_assert(std::alignment_of<T1>::value == 2, "");
+ static_assert(sizeof(T1) == 10, "");
+ }
+ {
+ typedef std::aligned_union<10, int >::type T1;
+ static_assert(std::alignment_of<T1>::value == 4, "");
+ static_assert(sizeof(T1) == 12, "");
+ }
+ {
+ typedef std::aligned_union<10, double >::type T1;
+ static_assert(std::alignment_of<T1>::value == 8, "");
+ static_assert(sizeof(T1) == 16, "");
+ }
+ {
+ typedef std::aligned_union<10, short, char >::type T1;
+ static_assert(std::alignment_of<T1>::value == 2, "");
+ static_assert(sizeof(T1) == 10, "");
+ }
+ {
+ typedef std::aligned_union<10, char, short >::type T1;
+ static_assert(std::alignment_of<T1>::value == 2, "");
+ static_assert(sizeof(T1) == 10, "");
+ }
+ {
+ typedef std::aligned_union<2, int, char, short >::type T1;
+ static_assert(std::alignment_of<T1>::value == 4, "");
+ static_assert(sizeof(T1) == 4, "");
+ }
+ {
+ typedef std::aligned_union<2, char, int, short >::type T1;
+ static_assert(std::alignment_of<T1>::value == 4, "");
+ static_assert(sizeof(T1) == 4, "");
+ }
+ {
+ typedef std::aligned_union<2, char, short, int >::type T1;
+ static_assert(std::alignment_of<T1>::value == 4, "");
+ static_assert(sizeof(T1) == 4, "");
+ }
+#endif
+}
diff --git a/libcxx/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp b/libcxx/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
index 87c22248813..c896aa20229 100644
--- a/libcxx/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
+++ b/libcxx/test/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
@@ -30,13 +30,13 @@ public:
int main()
{
- test_alignment_of<int&, sizeof(long) == 4 ? 4 : 8>();
+ test_alignment_of<int&, 4>();
test_alignment_of<Class, 1>();
test_alignment_of<int*, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<const int*, sizeof(long) == 4 ? 4 : 8>();
test_alignment_of<char[3], 1>();
test_alignment_of<int, 4>();
- test_alignment_of<double, sizeof(long) == 4 ? 4 : 8>();
+ test_alignment_of<double, 8>();
test_alignment_of<bool, 1>();
test_alignment_of<unsigned, 4>();
}
OpenPOWER on IntegriCloud