aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-30 02:05:41 +0800
committerchriseth <c@ethdev.com>2015-06-30 02:08:02 +0800
commit4e62efc7ff24cbe55a0690c44e406fadf3b596e0 (patch)
tree9ab1551a2b0a363ed08433cc7de3d35edaef949a
parent9cb646697dc3ebeb45255c1df44a922ed8d2ebbb (diff)
downloaddexon-solidity-4e62efc7ff24cbe55a0690c44e406fadf3b596e0.tar.gz
dexon-solidity-4e62efc7ff24cbe55a0690c44e406fadf3b596e0.tar.zst
dexon-solidity-4e62efc7ff24cbe55a0690c44e406fadf3b596e0.zip
Memory arrays cannot be resized.
-rw-r--r--libsolidity/SolidityNameAndTypeResolution.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp
index f24930ba..df976eae 100644
--- a/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -2026,6 +2026,19 @@ BOOST_AUTO_TEST_CASE(dynamic_return_types_not_possible)
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()
}