-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Open
Labels
bug 🐛medium effortDefault level of effortDefault level of effortmedium impactDefault level of impactDefault level of impactmust have eventuallySomething we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.
Description
Description
An immutable variable that is initialized at declaration site can be used in pure
context if it is of type uint
but not if it is of type address
.
Environment
- Compiler version: 0.8.29
Steps to Reproduce
// SPDX-License-Identifier: GPL-3.0
pragma solidity 0.8.29;
contract Test {
address internal immutable _a = 0x0000000000000000000000000000000000000001;
uint256 internal immutable _b = 42;
function a() external pure returns (address) {
return _a; // TypeError: Function declared as pure, but this expression (potentially) reads from the environment or state and thus requires "view".
}
function b() external pure returns (uint256) {
return _b; // no error
}
}
ernestognw and AmxxSaw-mon-and-Natalie
Metadata
Metadata
Assignees
Labels
bug 🐛medium effortDefault level of effortDefault level of effortmedium impactDefault level of impactDefault level of impactmust have eventuallySomething we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.Something we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.