mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Named assembly labels.
This commit is contained in:
committed by
Alex Beregszaszi
parent
7dd372ce5c
commit
73771f5bb2
@@ -398,6 +398,34 @@ BOOST_AUTO_TEST_CASE(calldata)
|
||||
)
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(function_name_collision)
|
||||
{
|
||||
// This tests a collision between a function name used by inline assembly
|
||||
// and by the ABI encoder
|
||||
string sourceCode = R"(
|
||||
contract C {
|
||||
function f(uint x) returns (uint) {
|
||||
assembly {
|
||||
function abi_encode_t_uint256_to_t_uint256() {
|
||||
mstore(0, 7)
|
||||
return(0, 0x20)
|
||||
}
|
||||
switch x
|
||||
case 0 { abi_encode_t_uint256_to_t_uint256() }
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
)";
|
||||
BOTH_ENCODERS(
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("f(uint256)", encodeArgs(0)) == encodeArgs(7));
|
||||
BOOST_CHECK(callContractFunction("f(uint256)", encodeArgs(1)) == encodeArgs(1));
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user