Solidity: False compiler DeclarationError: Modifier already used for this function

Created on 22 Jul 2017  路  5Comments  路  Source: ethereum/solidity

Solidity compiler throws an error

DeclarationError: Modifier already used for this function.

when a function uses modifier twice with different parameters, e.g.

modifier nonZeroAddress(address x) {
    require(x != 0);
    _;
  }

function X(address a, address b) 
nonZeroAddress(a)
nonZeroAddress(b)
{ ... }

bug

Most helpful comment

Ah, I see. To be honest, I did not consider multiple uses of the same modifier, but seeing your example, that was obviously a stupid assumption :-)

All 5 comments

This was introduced in #2460.

Why was the version not bumped to reflect #2460, which is a breaking change?

There are legitimate use cases to use the same modifier twice on the same function.

Ah, I see. To be honest, I did not consider multiple uses of the same modifier, but seeing your example, that was obviously a stupid assumption :-)

Will work on this.

No worries, thanks for the swift response 馃槃 Happy hacking!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chriseth picture chriseth  路  3Comments

chriseth picture chriseth  路  3Comments

VoR0220 picture VoR0220  路  4Comments

chriseth picture chriseth  路  4Comments

chriseth picture chriseth  路  4Comments