Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-address hex literals cannot be assigned to uint256 #15468

Open
haoyang9804 opened this issue Sep 30, 2024 · 0 comments
Open

non-address hex literals cannot be assigned to uint256 #15468

haoyang9804 opened this issue Sep 30, 2024 · 0 comments
Labels

Comments

@haoyang9804
Copy link
Contributor

Description

As described in 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:

function f() {
  address adr = 0xde74fE3E9482D11dAeBE981C1f5Bf1e5E3055c31; // pass
  address adr2 = 0xde74fE3E9482D11dAeBE981C1f5Bf1e5E3055c3; // fail
  uint256 a = 0xde74fE3E9482D11dAeBE981C1f5Bf1e5E3055c3; // fail
  uint256 b = 0xde74fE3E9482D11dAeBE981C1f5Bf1e5E3055c; // pass
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant