From 7b18ff7dd264df9675ff607d70315a8dbb370522 Mon Sep 17 00:00:00 2001 From: Yaron Keren Date: Tue, 18 Aug 2015 07:59:09 +0000 Subject: [PATCH] Add unit test for isLayoutIdentical(empty, empty). 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 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unittests/IR/TypesTest.cpp b/unittests/IR/TypesTest.cpp index 2cee640a13d..b4dbf8ec2c7 100644 --- a/unittests/IR/TypesTest.cpp +++ b/unittests/IR/TypesTest.cpp @@ -27,4 +27,12 @@ TEST(TypesTest, StructType) { EXPECT_FALSE(Struct->hasName()); } +TEST(TypesTest, LayoutIdenticalEmptyStructs) { + LLVMContext C; + + StructType *Foo = StructType::create(C, "Foo"); + StructType *Bar = StructType::create(C, "Bar"); + EXPECT_TRUE(Foo->isLayoutIdentical(Bar)); +} + } // end anonymous namespace -- 2.34.1