non-address hex literals cannot be assigned to uint256
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
## Description
As described in [Address Literals](https://docs.soliditylang.org/en/latest/types.html#address-literals), hex literals of the correct size that pass the checksum test are of address type.
An incorrect size of 38 can be converted to uint256, but a correct size of 39 that fail the checksum cannot be converted to uint256, which is confusing.
## Environment
- Compiler version: 0.8.28
- Operating system: macos
## Steps to Reproduce
Below is the reproducible test program:
```solidity
function f() {
address adr = 0xde74fE3E9482D11dAeBE981C1f5Bf1e5E3055c31; // pass
address adr2 = 0xde74fE3E9482D11dAeBE981C1f5Bf1e5E3055c3; // fail
uint256 a = 0xde74fE3E9482D11dAeBE981C1f5Bf1e5E3055c3; // fail
uint256 b = 0xde74fE3E9482D11dAeBE981C1f5Bf1e5E3055c; // pass
}
```
Contributor guide
Research direction
The issue names no implementation files or tests. Start by compiling the minimal Solidity program with compiler version 0.8.28 and trace how address literals are typed and converted; done should establish consistent handling for the four literal cases shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100