ICE in `FunctionType::withBoundFirstArgument` when `using for` binds a zero-parameter function
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 29
Description
The compiler panics with `Solidity assertion failed` in [`libsolidity/ast/Types.cpp:3753`](https://github.com/ethereum/solidity/blob/9be66192f9db40e5a43f71fc78e06b2f35e9ccdd/libsolidity/ast/Types.cpp#L3753) inside `FunctionType::withBoundFirstArgument()` when a free function with no parameters is listed in a `using { f } for T` directive and called as a bound method. The semantic check that rejects zero-parameter functions in `using for` bindings is bypassed when the `using` declaration appears **after** the call site in the contract body.
MRE:
```solidity
function zero() pure returns (uint) { return 0; }
contract C {
function f(uint z) pure external returns (uint) {
return z.zero();
}
using {zero} for uint;
}
```
Reproduce: save as `mre.sol`, run `solc --bin mre.sol`.
Output:
```
Internal compiler error:
/solidity/libsolidity/ast/Types.cpp(3753): Throw in function const solidity::frontend::FunctionType* solidity::frontend::FunctionType::withBoundFirstArgument() const
Dynamic exception type: boost::wrapexcept
std::exception::what: Solidity assertion failed
[solidity::util::tag_comment*] = Solidity assertion failed
```
Expected behavior: a type error rejecting `zero` in the `using for` binding because it has no parameters to bind to.
Git commit: 9be66192f
solc 0.8.35-develop.2026.4.18+commit.9be66192.Linux.g++
Contributor guide
Research direction
Start with libsolidity/ast/Types.cpp:3753 and FunctionType::withBoundFirstArgument(), then reproduce the issue using the provided mre.sol and solc --bin mre.sol command. The change is done when the zero-parameter function in the using for binding produces a type error rather than an internal compiler error.
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
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100