1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Fix bug: Assember2003-04-15-ConstantInitAssertion.llx

llvm-svn: 5777
This commit is contained in:
Chris Lattner 2003-04-15 16:09:31 +00:00
parent 9ae20ce596
commit f5ce9b1a74

View File

@ -919,8 +919,15 @@ ConstVal: Types '[' ConstVector ']' { // Nonempty unsized arr
if (STy == 0)
ThrowException("Cannot make struct constant with type: '" +
(*$1)->getDescription() + "'!");
// FIXME: TODO: Check to see that the constants are compatible with the type
// initializer!
// Check to ensure that constants are compatible with the type initializer!
for (unsigned i = 0, e = $3->size(); i != e; ++i)
if ((*$3)[i]->getType() != STy->getElementTypes()[i])
ThrowException("Expected type '" +
STy->getElementTypes()[i]->getDescription() +
"' for element #" + utostr(i) +
" of structure initializer!");
$$ = ConstantStruct::get(STy, *$3);
delete $1; delete $3;
}