diff options
author | Gav Wood <g@ethdev.com> | 2015-06-30 17:29:24 +0800 |
---|---|---|
committer | Gav Wood <g@ethdev.com> | 2015-06-30 17:29:24 +0800 |
commit | 59399f6f038f9e8ef45a21f0a65466f46a2a49c3 (patch) | |
tree | 9ab1551a2b0a363ed08433cc7de3d35edaef949a | |
parent | b7ad2ff5e6cf246e64fe73d81930c50870755f1b (diff) | |
parent | 4e62efc7ff24cbe55a0690c44e406fadf3b596e0 (diff) | |
download | dexon-solidity-59399f6f038f9e8ef45a21f0a65466f46a2a49c3.tar.gz dexon-solidity-59399f6f038f9e8ef45a21f0a65466f46a2a49c3.tar.zst dexon-solidity-59399f6f038f9e8ef45a21f0a65466f46a2a49c3.zip |
Merge pull request #2321 from chriseth/sol_memoryArraysNotResizeable
Memory arrays cannot be resized.
-rw-r--r-- | libsolidity/SolidityNameAndTypeResolution.cpp | 13 |
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() } |