Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function overflow clash #16

Open
Amxx opened this issue Sep 5, 2022 · 0 comments
Open

Function overflow clash #16

Amxx opened this issue Sep 5, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Amxx
Copy link
Collaborator

Amxx commented Sep 5, 2022

Reproducible example

In Test.sol:Foo

    //...
    struct Z {
        bool z;
    }

    struct Z2 {
        bool z;
    }

    function _testClash(S storage t) internal {}
    function _testClash(Z storage t) internal {}
    function _testClash(Z2 storage t) internal {}
    function _testClash(S memory t) internal {}
    function _testClash(Z memory t) internal {}
    function _testClash(Z2 memory t) internal {}
}

causes

TypeError: Function overload clash during conversion to external types for arguments.
  --> contracts-exposed/Test.sol:54:5:
   |
54 |     function $_testClash(Foo.Z2 calldata t) external {
   |     ^ (Relevant source part starts here and spans across multiple lines).

This is because the internal function use different types, but Z and Z2 have the same underlying type, cause the external version to have function selector clash.

Possible fix:

When constructing the clashingFunctions record, consider the resulting function selector, and not the internal type.

@Amxx Amxx added the bug Something isn't working label Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant