diff options
Diffstat (limited to 'libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp')
-rw-r--r-- | libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
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 |