mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Converted sub assembly to smart pointer.
This commit is contained in:
@@ -7757,7 +7757,7 @@ BOOST_AUTO_TEST_CASE(store_function_in_constructor)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract C {
|
||||
uint result_in_constructor;
|
||||
uint public result_in_constructor;
|
||||
function (uint) internal returns (uint) x;
|
||||
function C () {
|
||||
x = double;
|
||||
|
||||
@@ -1238,6 +1238,24 @@ BOOST_AUTO_TEST_CASE(inconsistency)
|
||||
compareVersions("trigger()");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(dead_code_elimination_across_assemblies)
|
||||
{
|
||||
// This tests that a runtime-function that is stored in storage in the constructor
|
||||
// is not removed as part of dead code elimination.
|
||||
char const* sourceCode = R"(
|
||||
contract DCE {
|
||||
function () internal returns (uint) stored;
|
||||
function DCE() {
|
||||
stored = f;
|
||||
}
|
||||
function f() internal returns (uint) { return 7; }
|
||||
function test() returns (uint) { return stored(); }
|
||||
}
|
||||
)";
|
||||
compileBothVersions(sourceCode);
|
||||
compareVersions("test()");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user