solc 0.4.17 compile errors for pure functions
See original GitHub issueWith the truffle
4 beta 2 release which includes the solc@0.4.17
upgrade instrumented contracts containing functions decorated with view
will generate a Warning, while those marked as pure
will Error with
TypeError: Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
This is due to the SC instrumented function containing events (which modify state) being present in the pure
function.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:22 (15 by maintainers)
Top Results From Across the Web
Solidity Documentation - Read the Docs
Solidity is statically typed, supports inheritance, libraries and complex user-defined types among other features.
Read more >Truffle compiler stuck at 0.4.17 - Ethereum Stack Exchange
If I keep writing, I keep getting errors due to deprecated error highlighting ( constructor and emit events not working, now is okay...)....
Read more >Contracts — Solidity 0.8.17 documentation
Functions can be declared pure in which case they promise not to read from or modify the state. In particular, it should be...
Read more >Declare constant at file level in solidity 0.4.17 - Stack Overflow
pragma solidity ^0.4.17; contract MyContract { uint256 constant ... library Constants { function MY_CONSTANT() public pure returns (uint256) ...
Read more >Contracts — Solidity 0.5.10 documentation - Read the Docs
When a contract is created, its constructor (a function declared with the ... Before version 0.4.17 the compiler did not enforce that pure...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I seem to be facing the same issue with
0.5.8
.MyContract.sol
inherits fromopenzeppelin-zos/contracts/token/ERC20/ERC20.sol
and implments the allowance function with the same signature.Thanks @cgewecke Compilation failed for me in the following scenario: Contract inhering from another which lives outside the
/contracts
folder, e.g. a git submodule library for me specifically it looks like this:This generates compile error: