diff options
Diffstat (limited to 'libcxx/test/std/utilities/meta')
-rw-r--r-- | libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp | 9 | ||||
-rw-r--r-- | libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp | 8 |
2 files changed, 10 insertions, 7 deletions
diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp index d7e35a62f8f..012741ff6c7 100644 --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/aligned_storage.pass.cpp @@ -254,9 +254,6 @@ int main() // 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 TEST_STD_VER < 11 -#define alignof __alignof__ -#endif { typedef std::aligned_storage<16>::type T1; #if TEST_STD_VER > 11 @@ -264,7 +261,7 @@ int main() #endif static_assert(std::is_trivial<T1>::value, ""); static_assert(std::is_standard_layout<T1>::value, ""); - static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t), + static_assert(std::alignment_of<T1>::value == TEST_ALIGNOF(std::max_align_t), ""); static_assert(sizeof(T1) == 16, ""); } @@ -275,9 +272,9 @@ int main() #endif static_assert(std::is_trivial<T1>::value, ""); static_assert(std::is_standard_layout<T1>::value, ""); - static_assert(std::alignment_of<T1>::value == alignof(std::max_align_t), + static_assert(std::alignment_of<T1>::value == TEST_ALIGNOF(std::max_align_t), ""); - static_assert(sizeof(T1) == 16 + alignof(std::max_align_t), ""); + static_assert(sizeof(T1) == 16 + TEST_ALIGNOF(std::max_align_t), ""); } { typedef std::aligned_storage<10>::type T1; diff --git a/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp index 0f55db64719..bd02da96978 100644 --- a/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp @@ -19,6 +19,9 @@ template <class T, unsigned A> void test_alignment_of() { + const unsigned AlignofResult = TEST_ALIGNOF(T); + static_assert( AlignofResult == A, "Golden value does not match result of alignof keyword"); + static_assert( std::alignment_of<T>::value == AlignofResult, ""); static_assert( std::alignment_of<T>::value == A, ""); static_assert( std::alignment_of<const T>::value == A, ""); static_assert( std::alignment_of<volatile T>::value == A, ""); @@ -45,7 +48,10 @@ int main() test_alignment_of<const int*, sizeof(intptr_t)>(); test_alignment_of<char[3], 1>(); test_alignment_of<int, 4>(); - test_alignment_of<double, 8>(); + // The test case below is a hack. It's hard to detect what golden value + // we should expect. In most cases it should be 8. But in i386 builds + // with Clang >= 8 or GCC >= 8 the value is '4'. + test_alignment_of<double, TEST_ALIGNOF(double)>(); #if (defined(__ppc__) && !defined(__ppc64__)) test_alignment_of<bool, 4>(); // 32-bit PPC has four byte bool #else |