Permit use of non-literal constants inside inline assembly
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
```
contract C {
enum E { E1, E2 }
E constant c = E.E1;
function f() external {
assembly {
let x := c
}
}
}
```
errors on the use of the constant inside inline assembly.
```
Error: Only direct number constants and references to such constants are supported by inline assembly.
```
The same happens for constant expressions
```
contract C {
bool constant c = (2 > 3 ? true : false);
function f() external {
assembly {
let x := c
}
}
}
```
and constants assigned a constructed value (not literal)
```
contract C {
bool constant c = bool(true);
function f() external {
assembly {
let x := c
}
}
}
```
Contributor guide
Research direction
No source file, test, or compiler entry point is named. Start by reproducing the three Solidity examples and trace how inline assembly resolves constants; done means enum constants, constant expressions, and constructed constant values are accepted there without the reported error, with regression coverage for these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, solidity
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100