mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Don't assume that an expression cannot be associated with a function declaration
This commit is contained in:
parent
50b200a5d5
commit
f574d8ec3a
@ -675,8 +675,6 @@ void IRGeneratorForStatements::endVisit(FunctionCall const& _functionCall)
|
|||||||
|
|
||||||
solAssert(functionDef->isImplemented(), "");
|
solAssert(functionDef->isImplemented(), "");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
solAssert(!functionType->hasDeclaration(), "");
|
|
||||||
|
|
||||||
solAssert(!functionType->takesArbitraryParameters(), "");
|
solAssert(!functionType->takesArbitraryParameters(), "");
|
||||||
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
contract C {
|
||||||
|
function foo() internal returns (uint) {
|
||||||
|
return 42;
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_ptr(function() internal returns (uint) ptr) internal returns(function() internal returns (uint)) {
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
function associated() public returns (uint) {
|
||||||
|
// This expression directly references function definition
|
||||||
|
return (foo)();
|
||||||
|
}
|
||||||
|
|
||||||
|
function unassociated() public returns (uint) {
|
||||||
|
// This expression is not associated with a specific function definition
|
||||||
|
return (get_ptr(foo))();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ====
|
||||||
|
// compileViaYul: also
|
||||||
|
// ----
|
||||||
|
// associated() -> 42
|
||||||
|
// unassociated() -> 42
|
Loading…
Reference in New Issue
Block a user