mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Issue proper warning trying to access calldata variables in inline assembly
This commit is contained in:
@@ -5428,6 +5428,20 @@ BOOST_AUTO_TEST_CASE(inline_assembly_storage_variable_access_out_of_functions)
|
||||
CHECK_SUCCESS_NO_WARNINGS(text);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(inline_assembly_calldata_variables)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract C {
|
||||
function f(bytes bytesAsCalldata) external {
|
||||
assembly {
|
||||
let x := bytesAsCalldata
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_ERROR(text, TypeError, "Call data elements cannot be accessed directly.");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(invalid_mobile_type)
|
||||
{
|
||||
char const* text = R"(
|
||||
|
||||
Reference in New Issue
Block a user