aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-07-11 19:37:34 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-07-12 16:48:44 +0800
commitdb7ad508f8ad33389ae507967aebc05aaf31b94b (patch)
treecb36442efdde7fffc045ca4f87f7635d6e976b94 /test/libsolidity
parent699a3724ae57168578dbc9844ca20c4af1ed7bcf (diff)
downloaddexon-solidity-db7ad508f8ad33389ae507967aebc05aaf31b94b.tar.gz
dexon-solidity-db7ad508f8ad33389ae507967aebc05aaf31b94b.tar.zst
dexon-solidity-db7ad508f8ad33389ae507967aebc05aaf31b94b.zip
Issue proper warning trying to access calldata variables in inline assembly
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp14
1 files changed, 14 insertions, 0 deletions
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"(