solidity/test/libsolidity/semanticTests/calldata/calldata_internal_function_pointer.sol

20 lines
540 B
Solidity
Raw Normal View History

2020-05-25 17:30:42 +00:00
contract C {
2020-12-14 17:34:40 +00:00
function(bytes calldata) returns (bytes1) x;
2020-06-23 12:14:24 +00:00
constructor() { x = f; }
2020-12-14 17:34:40 +00:00
function f(bytes calldata b) internal pure returns (bytes1) {
2020-05-25 17:30:42 +00:00
return b[2];
}
2020-12-14 17:34:40 +00:00
function h(bytes calldata b) external returns (bytes1) {
2020-05-25 17:30:42 +00:00
return x(b);
}
2020-12-14 17:34:40 +00:00
function g() external returns (bytes1) {
2020-05-25 17:30:42 +00:00
bytes memory a = new bytes(34);
2020-12-14 17:34:40 +00:00
a[2] = bytes1(uint8(7));
2020-05-25 17:30:42 +00:00
return this.h(a);
}
}
// ====
// compileViaYul: also
2020-05-25 17:30:42 +00:00
// ----
// g() -> 0x0700000000000000000000000000000000000000000000000000000000000000