Relax one assertion -- long double has strange alignments on lots of
authorChandler Carruth <chandlerc@gmail.com>
Sat, 16 Jun 2012 09:44:00 +0000 (09:44 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Sat, 16 Jun 2012 09:44:00 +0000 (09:44 +0000)
platforms.

Also, remove one assertion on MSVC because it produces a completely
preposterous result, claiming something needs 12-byte alignment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158599 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Support/AlignOfTest.cpp

index c413451f9046ef8a4cfb99d8bf142395cc4ac57c..461b1d67e068394756971e3db9cddc9d4fb333cd 100644 (file)
@@ -139,7 +139,7 @@ TEST(AlignOfTest, BasicAlignmentInvariants) {
   EXPECT_LE(alignOf<long>(),   alignOf<long long>());
   EXPECT_LE(alignOf<char>(),   alignOf<float>());
   EXPECT_LE(alignOf<float>(),  alignOf<double>());
-  EXPECT_LE(alignOf<double>(), alignOf<long double>());
+  EXPECT_LE(alignOf<char>(),   alignOf<long double>());
   EXPECT_LE(alignOf<char>(),   alignOf<void *>());
   EXPECT_EQ(alignOf<void *>(), alignOf<int *>());
   EXPECT_LE(alignOf<char>(),   alignOf<S1>());
@@ -246,7 +246,12 @@ TEST(AlignOfTest, BasicAlignedArray) {
   EXPECT_EQ(alignOf<V5>(), alignOf<AlignedCharArray<V5>::union_type>());
   EXPECT_EQ(alignOf<V6>(), alignOf<AlignedCharArray<V6>::union_type>());
   EXPECT_EQ(alignOf<V7>(), alignOf<AlignedCharArray<V7>::union_type>());
+
+  // Some versions of MSVC get this wrong somewhat disturbingly. The failure
+  // appears to be benign: alignOf<V8>() produces a preposterous value: 12
+#ifndef _MSC_VER
   EXPECT_EQ(alignOf<V8>(), alignOf<AlignedCharArray<V8>::union_type>());
+#endif
 }
 
 }