The following snippet results in yul that is rejected by solc:
data Wrapper = Wrapper(word);
contract C {
function main() -> word {
return foo(Wrapper(1));
}
function foo(w:Wrapper) -> word {
let result : word;
match w {
| Wrapper(ptr) =>
//let ptr2 : word = ptr;
assembly { result := calldataload(ptr) }
}
return result;
}
}
Error: Identifier "ptr" not found.
--> bug.yul:7:30:
|
7 | result := calldataload(ptr)
| ^^^
uncommenting the let ptr2 ... line and using ptr2 as the arg to calldataload fixes the error.