Skip to content

ICE in FunctionType::withBoundFirstArgument when using for binds a zero-parameter function #16610

@jubnzv

Description

@jubnzv

The compiler panics with Solidity assertion failed in libsolidity/ast/Types.cpp:3753 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:

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<solidity::langutil::InternalCompilerError>
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: 9be6619
solc 0.8.35-develop.2026.4.18+commit.9be66192.Linux.g++

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛low impactChanges are not very noticeable or potential benefits are limited.medium effortDefault level of effortmust have eventuallySomething we consider essential but not enough to prevent us from releasing Solidity 1.0 without it.

    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