From db7ad508f8ad33389ae507967aebc05aaf31b94b Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 11 Jul 2017 12:37:34 +0100 Subject: Issue proper warning trying to access calldata variables in inline assembly --- test/libsolidity/SolidityNameAndTypeResolution.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test') diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 637ff5cc..2ee5baac 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -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"( -- cgit v1.2.3