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

"this used in constructor" static analysis rule has false positives #3843

Closed
frangio opened this issue Apr 6, 2018 · 1 comment
Closed
Assignees
Labels

Comments

@frangio
Copy link
Contributor

frangio commented Apr 6, 2018

One of the warnings emitted by the static analyzer is "this" used in constructor from #2605.

if (type->contractDefinition() == *m_currentContract)
m_errorReporter.warning(_memberAccess.location(), "\"this\" used in constructor.");

The warning was implemented by checking that the static type of the LHS of a member access is the same as the contract being defined. But this wrongly catches other scenarios too such as:

pragma solidity ^0.4.14;

contract Foo {
    bool public bar;
    
    function Foo(Foo other) public {
        require(other.bar());
    }
}
@nbauernfeind
Copy link

Using super also causes a false positive. See #3861.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants