aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/syntaxTests/constants/pure_non_rational.sol
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-12 17:49:08 +0800
committerGitHub <noreply@github.com>2018-04-12 17:49:08 +0800
commitc3dc67d0e0c311a907e7a27e159f9159d78af949 (patch)
tree5931874703a65e74c9319a06381ea769c2e402a9 /test/libsolidity/syntaxTests/constants/pure_non_rational.sol
parentea445b9d372ad99f5c705628104db36bcb0d33a2 (diff)
parentd42476e241489447e5dc4f5b1fafc8000e635fbc (diff)
downloaddexon-solidity-c3dc67d0e0c311a907e7a27e159f9159d78af949.tar.gz
dexon-solidity-c3dc67d0e0c311a907e7a27e159f9159d78af949.tar.zst
dexon-solidity-c3dc67d0e0c311a907e7a27e159f9159d78af949.zip
Merge pull request #3848 from ethereum/constantDivisionByZero
Error on invalid arithmetic with constant expressions.
Diffstat (limited to 'test/libsolidity/syntaxTests/constants/pure_non_rational.sol')
-rw-r--r--test/libsolidity/syntaxTests/constants/pure_non_rational.sol11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/constants/pure_non_rational.sol b/test/libsolidity/syntaxTests/constants/pure_non_rational.sol
new file mode 100644
index 00000000..4b96f1c7
--- /dev/null
+++ b/test/libsolidity/syntaxTests/constants/pure_non_rational.sol
@@ -0,0 +1,11 @@
+// Tests that the ConstantEvaluator does not crash for pure non-rational functions.
+// Currently it does not evaluate such functions, but this may change in the future
+// causing a division by zero error for a.
+contract C {
+ uint constant a = 1 / (uint(keccak256([0])[0]) - uint(keccak256([0])[0]));
+ uint constant b = 1 / uint(keccak256([0]));
+ uint constant c = uint(keccak256([0]));
+ uint[c] mem;
+}
+// ----
+// TypeError: (392-393): Invalid array length, expected integer literal or constant expression.