solidity/test/libsolidity/syntaxTests/structs/memory_to_calldata.sol

13 lines
666 B
Solidity

pragma experimental ABIEncoderV2;
contract Test {
struct S { int a; }
function f(S calldata s) external { s = S(2); }
function g(S calldata s) external { S memory m; s = m; }
}
// ----
// Warning: (0-33): Experimental features are turned on. Do not use experimental features on live deployments.
// TypeError: (114-115): Expression has to be an lvalue.
// TypeError: (118-122): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata.
// TypeError: (178-179): Expression has to be an lvalue.
// TypeError: (182-183): Type struct Test.S memory is not implicitly convertible to expected type struct Test.S calldata.