mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Memory arrays cannot be resized.
This commit is contained in:
parent
9cb646697d
commit
4e62efc7ff
@ -2026,6 +2026,19 @@ BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible)
|
|||||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(memory_arrays_not_resizeable)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract C {
|
||||||
|
function f() {
|
||||||
|
uint[] memory x;
|
||||||
|
x.length = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user