Add unit test for isLayoutIdentical(empty, empty).
authorYaron Keren <yaron.keren@gmail.com>
Tue, 18 Aug 2015 07:59:09 +0000 (07:59 +0000)
committerYaron Keren <yaron.keren@gmail.com>
Tue, 18 Aug 2015 07:59:09 +0000 (07:59 +0000)
It was previously asserting in Visual C++ debug mode on a null
iterator passed to std::equal.

Test by Hans Wennborg!

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

unittests/IR/TypesTest.cpp

index 2cee640a13d3345ff89c34319e161b803ea83a7f..b4dbf8ec2c73f108ac396a3f48fc38acce952022 100644 (file)
@@ -27,4 +27,12 @@ TEST(TypesTest, StructType) {
   EXPECT_FALSE(Struct->hasName());
 }
 
+TEST(TypesTest, LayoutIdenticalEmptyStructs) {\r
+  LLVMContext C;\r
+\r
+  StructType *Foo = StructType::create(C, "Foo");\r
+  StructType *Bar = StructType::create(C, "Bar");\r
+  EXPECT_TRUE(Foo->isLayoutIdentical(Bar));\r
+}\r
+
 }  // end anonymous namespace