soliditypp icon indicating copy to clipboard operation
soliditypp copied to clipboard

An internal error occurs if the receive function calls an internal function

Open charles-liu opened this issue 2 years ago • 0 comments

Compile the following contract:

// SPDX-License-Identifier: GPL-3.0
pragma soliditypp ^0.8.0;

contract TestReceive {
    receive() external payable {
        uint i = test();
    }

    function test() pure internal returns(uint) {
        return 3;
    }
}

You will get an internal error:

Internal compiler error during compilation:
/solidity/libsolidity/interface/CompilerStack.cpp(1226): Throw in function void solidity::frontend::CompilerStack::compileContract(const solidity::frontend::ContractDefinition &, map<const solidity::frontend::ContractDefinition *, shared_ptr<const solidity::frontend::Compiler>> &)
Dynamic exception type: boost::wrapexcept<solidity::langutil::InternalCompilerError>
std::exception::what: Assembly exception for bytecode: Reference to tag without position: 7
[solidity::util::tag_comment*] = Assembly exception for bytecode: Reference to tag without position: 7

charles-liu avatar Apr 01 '22 19:04 charles-liu