contract Test {
    function f() public returns(uint r) {
        uint x = 100;
        assembly {
            function f(x) -> y { y := add(x, 1) }
            r := f(100)

Use the latest compiler to compile this Test contract, got a error:

DeclarationError: Cannot access local Solidity variables from inside an inline assembly function.

Is it right or bug?

  • Hi there. Are you asking whether this should be allowed, given that the two x variables are in a different scope? May 7 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.