Skip to content

ICE in Type::operatorDefinitions when a zero-parameter function is bound as an operator via using for #16613

@jubnzv

Description

@jubnzv

The compiler panics with Solidity assertion failed in libsolidity/ast/Types.cpp:409 inside Type::operatorDefinitions() when a using { f } for T directive binds a zero-parameter function as an operator alongside a valid binding.

MRE:

type T is int256;
function f(T a, T b) pure returns (T) {}
function g() pure returns (T) {}
using {f as -, g as -} for T global;

Reproduce: save as mre.sol, run solc --bin mre.sol.

Output:

Internal compiler error:
/solidity/libsolidity/ast/Types.cpp(409): Throw in function std::set<const solidity::frontend::FunctionDefinition*, solidity::frontend::ASTCompareByID<solidity::frontend::ASTNode> > solidity::frontend::Type::operatorDefinitions(solidity::langutil::Token, const solidity::frontend::ASTNode&, bool) const
Dynamic exception type: boost::wrapexcept<solidity::langutil::InternalCompilerError>
std::exception::what: Solidity assertion failed
[solidity::util::tag_comment*] = Solidity assertion failed

Expected behavior: a type error at the using directive rejecting g as an operator binding because it has no parameters.

Git commit: 9be6619
solc 0.8.35-develop.2026.4.18+commit.9be66192.Linux.g++

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions