ICE in `TypeChecker::endVisit(BinaryOperation)` when duplicate `using for` operator bindings include a self-referential call
- Dominant language
- C++
- Stars
- 25.7k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 21
Description
The compiler panics with `Solidity assertion failed` in [`libsolidity/analysis/TypeChecker.cpp:1706`](https://github.com/ethereum/solidity/blob/9be66192f9db40e5a43f71fc78e06b2f35e9ccdd/libsolidity/analysis/TypeChecker.cpp#L1706) when two functions are bound to the same operator via `using for` and one of them uses that operator in its own body.
MRE:
```solidity
type T is int256;
function sub(T a, T b) pure returns (T) {}
function add(T a, T b) pure returns (T) { T c = a + b; }
using {sub as +, add as +} for T global;
```
Reproduce: save as `mre.sol`, run `solc --bin mre.sol`.
Output:
```
Internal compiler error:
/solidity/libsolidity/analysis/TypeChecker.cpp(1706): Throw in function virtual void solidity::frontend::TypeChecker::endVisit(const solidity::frontend::BinaryOperation&)
Dynamic exception type: boost::wrapexcept
std::exception::what: Solidity assertion failed
[solidity::util::tag_comment*] = Solidity assertion failed
```
Expected behavior: a type error about duplicate operator bindings for `+` before any operator expression is type-checked.
Git commit: 9be66192f
solc 0.8.35-develop.2026.4.18+commit.9be66192.Linux.g++
Contributor guide
Research direction
Start at libsolidity/analysis/TypeChecker.cpp:1706 and reproduce the ICE with the provided mre.sol using solc --bin mre.sol. Trace duplicate using-for operator binding handling before the self-referential binary operation; done when the example reports a type error about duplicate + bindings instead of 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
- 74/100