mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add test to check ConstantEvaluator for pure non-rational functions.
This commit is contained in:
parent
932915633b
commit
d42476e241
11
test/libsolidity/syntaxTests/constants/pure_non_rational.sol
Normal file
11
test/libsolidity/syntaxTests/constants/pure_non_rational.sol
Normal file
@ -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.
|
Loading…
Reference in New Issue
Block a user