mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
13 lines
512 B
Solidity
13 lines
512 B
Solidity
contract D {
|
|
uint x;
|
|
modifier viewm(uint) { uint a = x; _; a; }
|
|
modifier nonpayablem(uint) { x = 2; _; }
|
|
}
|
|
contract C is D {
|
|
function f() viewm(0) pure public {}
|
|
function g() nonpayablem(0) view public {}
|
|
}
|
|
// ----
|
|
// TypeError 2527: (154-162): Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
|
|
// TypeError 8961: (195-209): Function cannot be declared as view because this expression (potentially) modifies the state.
|