Output error when forward referencing constants in inline assembly

This commit is contained in:
Mathias Baumann
2020-06-02 14:37:54 +02:00
parent 79f4a2b476
commit bdc2c63327
4 changed files with 38 additions and 8 deletions
@@ -0,0 +1,8 @@
contract C {
function f() public pure {
assembly {
pop(add(add(1, 2), c))
}
}
int constant c = 1;
}
@@ -0,0 +1,12 @@
contract C {
function f() {
assembly {
c := add(add(1, 2), c)
}
}
int constant c = 0 + 1;
}
// ----
// SyntaxError: (15-83): No visibility specified. Did you intend to add "public"?
// TypeError: (71-72): Constant variables with non-literal values cannot be forward referenced from inline assembly.
// TypeError: (51-52): Constant variables cannot be assigned to.