Skip to content

Internal compiler error on function name collision #4417

@mathiasestolarz

Description

@mathiasestolarz

Solidity version:

0.4.24+commit.e67f0147.Linux.g++

Source code:

pragma solidity ^0.4.24;

contract SomeContract {

  uint public balance = 0;


  function balance(uint number) public {
    
  }

  function doSomething() public {
    balance(3);
  }
}

Platform:

Ubuntu 16.04.4 LTS

How to reproduce the issue:

Run a bash script that compiles the contract like this:

#!/bin/sh

solc SomeContract.sol

What was the result of the issue:

This output in the console:

Internal compiler error during compilation:
/build/solc-FodDYg/solc-0.4.24/libsolidity/analysis/TypeChecker.cpp(2260): Throw in function virtual bool dev::solidity::TypeChecker::visit(const dev::solidity::Identifier&)
Dynamic exception type: boost::exception_detail::clone_impl<dev::solidity::InternalCompilerError>
std::exception::what: Requested type not present.
[dev::tag_comment*] = Requested type not present.

What the expected behaviour is:

Correct compilation because of the different signatures the getter of the balance variable and the balance function have.

Observations:

pragma solidity ^0.4.24;

contract SomeContract {

  mapping(uint => uint) public balance;

  function balance() public {
    
  }

  function doSomething() public {
    balance();
  }
}
  • In this case, the same output is shown.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions