solidity icon indicating copy to clipboard operation
solidity copied to clipboard

ICE for emit statement with argument of function type

Open alex2449 opened this issue 3 weeks ago • 0 comments

Description

The following code triggers an ICE when compiling with --ir. I think the issue comes from passing a function type that is not identical but implicitly convertible to an indexed event parameter.

Steps to Reproduce

testcase.sol

// SPDX-License-Identifier: GPL-3.0

pragma solidity =0.8.30;

contract C {
    event W(function () external view indexed p);

    function f(function () external pure p) public {
        emit W(p);
    }
}

solc --ir testcase.sol

Internal compiler error:
/solidity/libsolidity/codegen/ir/IRGeneratorForStatements.cpp(1093): Throw in function virtual void solidity::frontend::IRGeneratorForStatements::endVisit(const solidity::frontend::FunctionCall&)
Dynamic exception type: boost::wrapexcept<solidity::langutil::InternalCompilerError>
std::exception::what: Solidity assertion failed
[solidity::util::tag_comment*] = Solidity assertion failed

Environment

  • Compiler version: 0.8.30

alex2449 avatar Nov 22 '25 22:11 alex2449