diff --git a/Changelog.md b/Changelog.md index 92018a771..b09c1cd2c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -10,6 +10,7 @@ Compiler Features: Bugfixes: + * Antlr Grammar: Allow builtin names in ``yulPath`` to support ``.address`` in function pointers. * Control Flow Graph: Perform proper virtual lookup for modifiers for uninitialized variable and unreachable code analysis. * Immutables: Fix wrong error when the constructor of a base contract uses ``return`` and the parent contract contains immutable variables. * TypeChecker: Fix ICE when a constant variable declaration forward references a struct. diff --git a/docs/grammar/SolidityParser.g4 b/docs/grammar/SolidityParser.g4 index f7630c59e..110773fed 100644 --- a/docs/grammar/SolidityParser.g4 +++ b/docs/grammar/SolidityParser.g4 @@ -564,7 +564,7 @@ yulFunctionDefinition: * While only identifiers without dots can be declared within inline assembly, * paths containing dots can refer to declarations outside the inline assembly block. */ -yulPath: YulIdentifier (YulPeriod YulIdentifier)*; +yulPath: YulIdentifier (YulPeriod (YulIdentifier | YulEVMBuiltin))*; /** * A call to a function with return values can only occur as right-hand side of an assignment or * a variable declaration. diff --git a/test/libsolidity/syntaxTests/inlineAssembly/assignment_to_function_pointer.sol b/test/libsolidity/syntaxTests/inlineAssembly/assignment_to_function_pointer.sol new file mode 100644 index 000000000..38e88eeeb --- /dev/null +++ b/test/libsolidity/syntaxTests/inlineAssembly/assignment_to_function_pointer.sol @@ -0,0 +1,9 @@ +contract C { + function f() public pure { + function() external g; + assembly { + g.address := 0x42 + g.selector := 0x23 + } + } +}