mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Semantic test where constructor has a function as parameter
This commit is contained in:
parent
0135cae222
commit
e24a23edcd
@ -0,0 +1,9 @@
|
||||
// The IR of this test used to throw
|
||||
contract D {
|
||||
constructor(function() external returns (uint)) {
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// constructor(): 0xfdd67305928fcac8d213d1e47bfa6165cd0b87b946644cd0000000000000000 ->
|
@ -0,0 +1,21 @@
|
||||
contract D {
|
||||
uint public x;
|
||||
constructor(function() external pure returns (uint) g) {
|
||||
x = g();
|
||||
}
|
||||
}
|
||||
|
||||
contract C {
|
||||
function f() public returns (uint r) {
|
||||
D d = new D(this.sixteen);
|
||||
r = d.x();
|
||||
}
|
||||
|
||||
function sixteen() public pure returns (uint) {
|
||||
return 16;
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 16
|
Loading…
Reference in New Issue
Block a user