Avoid passing nullptr to std::equal.

As documented in the LLVM Coding Standards, indeed MSVC incorrectly asserts 
on this in Debug mode. This happens when building clang with Visual C++ and
-triple i686-pc-windows-gnu on these clang regression tests:

 clang/test/CodeGen/2011-03-08-ZeroFieldUnionInitializer.c
 clang/test/CodeGen/empty-union-init.c



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@243996 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Yaron Keren 2015-08-04 15:57:04 +00:00
parent 0d2030d07e
commit a639e155a2

@ -612,7 +612,8 @@ bool StructType::isLayoutIdentical(StructType *Other) const {
getNumElements() != Other->getNumElements())
return false;
return std::equal(element_begin(), element_end(), Other->element_begin());
return element_begin() &&
std::equal(element_begin(), element_end(), Other->element_begin());
}
/// getTypeByName - Return the type with the specified name, or null if there