diff --git a/Changelog.md b/Changelog.md index 954518dc5..2877bbf8c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -23,6 +23,7 @@ Compiler Features: Bugfixes: * Parser: Disallow several ``indexed`` attributes for the same event parameter. + * Parser: Disallow usage of the ``indexed`` attribute for modifier parameters. * Yul Optimizer: Hash hex and decimal literals according to their value instead of their representation, improving the detection of equivalent functions. * Solidity Upgrade Tool ``solidity-upgrade``: Fix the tool returning success code on uncaught exceptions. * SMTChecker: Fix display error for negative integers that are one more than powers of two. diff --git a/libsolidity/parsing/Parser.cpp b/libsolidity/parsing/Parser.cpp index e028b13ac..a9065b176 100644 --- a/libsolidity/parsing/Parser.cpp +++ b/libsolidity/parsing/Parser.cpp @@ -879,7 +879,6 @@ ASTPointer Parser::parseModifierDefinition() if (m_scanner->currentToken() == Token::LParen) { VarDeclParserOptions options; - options.allowIndexed = true; options.allowLocationSpecifier = true; parameters = parseParameterList(options); } diff --git a/test/libsolidity/syntaxTests/modifiers/invalid_parameter_indexed.sol b/test/libsolidity/syntaxTests/modifiers/invalid_parameter_indexed.sol new file mode 100644 index 000000000..a19d7beb2 --- /dev/null +++ b/test/libsolidity/syntaxTests/modifiers/invalid_parameter_indexed.sol @@ -0,0 +1,5 @@ +contract B { + modifier mod1(uint indexed a) { _; } +} +// ---- +// ParserError 2314: (36-43): Expected ',' but got 'indexed'