aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-02 08:24:45 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-02 08:24:45 +0800
commit697db80b48fbed596996a2dab20948f42fdb1dfb (patch)
treed0e0226662467b5c4c9243943bbf86054ca81352 /test/libsolidity
parentc01f5699e673f600fe87056b414996fef2224242 (diff)
downloaddexon-solidity-697db80b48fbed596996a2dab20948f42fdb1dfb.tar.gz
dexon-solidity-697db80b48fbed596996a2dab20948f42fdb1dfb.tar.zst
dexon-solidity-697db80b48fbed596996a2dab20948f42fdb1dfb.zip
Disallow arrays with negative length
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index f5768022..0151d244 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -1919,6 +1919,16 @@ BOOST_AUTO_TEST_CASE(array_with_nonconstant_length)
CHECK_ERROR(text, TypeError, "");
}
+BOOST_AUTO_TEST_CASE(array_with_negative_length)
+{
+ char const* text = R"(
+ contract c {
+ function f(uint a) { uint8[-1] x; }
+ }
+ )";
+ CHECK_ERROR(text, TypeError, "Array with negative length specified");
+}
+
BOOST_AUTO_TEST_CASE(array_copy_with_different_types1)
{
char const* text = R"(