solidity/test/libsolidity/syntaxTests/viewPureChecker/local_storage_variables_fail.sol

16 lines
486 B
Solidity
Raw Normal View History

2018-07-04 09:25:45 +00:00
contract C {
struct S { uint a; }
S s;
function f() pure public {
S storage x = s;
x;
}
function g() view public {
S storage x = s;
x.a = 1;
}
}
// ----
// TypeError 2527: (100-101): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
2022-02-17 15:52:36 +00:00
// TypeError 8961: (184-187): Function cannot be declared as view because this expression (potentially) modifies the state.