aboutsummaryrefslogblamecommitdiffstats
path: root/test/libsolidity/syntaxTests/viewPureChecker/local_storage_variables_fail.sol
blob: 0ff1ac241fc692b09b0cfcb3568ee31307a7e6c7 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                                                                                                                
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: (100-101): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
// TypeError: (184-187): Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.