[ICE]: Setting the selector to public causes an error.
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
solc version: 0.8.29
description: The statement **bytes4 public constant s2 = B.g.selector;** causes a compilation error, but removing public resolves the issue.
```solidity
interface A {
function f() external;
}
contract B {
function g() public {}
}
contract C is B {
function h() external {}
bytes4 constant s1 = A.f.selector;
bytes4 public constant s2 = B.g.selector;
bytes4 constant s3 = this.h.selector;
bytes4 constant s4 = super.g.selector;
}
```
```
solc_0829 test.sol --combined-json bin,abi --via-ir --optimize
Uncaught exception:
Dynamic exception type: std::out_of_range
std::exception::what: map::at
```
Contributor guide
Research direction
Reproduce the failure with the provided Solidity snippet using solc 0.8.29 and the shown --via-ir --optimize command. Trace compiler handling of the public constant selector and verify that compilation reports a normal result instead of the std::out_of_range exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100