Issue proper warning trying to access calldata variables in inline assembly

This commit is contained in:
Alex Beregszaszi
2017-07-12 10:48:44 +02:00
parent 699a3724ae
commit db7ad508f8
3 changed files with 19 additions and 1 deletions
@@ -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"(