solidity/test/libsolidity/semanticTests/various/code_access_create.sol

29 lines
440 B
Solidity
Raw Normal View History

contract D {
uint256 x;
constructor() public {
x = 7;
}
function f() public view returns (uint256) {
return x;
}
}
contract C {
function test() public returns (uint256) {
bytes memory c = type(D).creationCode;
D d;
assembly {
d := create(0, add(c, 0x20), mload(c))
}
return d.f();
}
}
2020-05-06 15:40:06 +00:00
// ====
// compileViaYul: also
// ----
// test() -> 7