diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-02-20 18:17:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-20 18:17:58 +0800 |
commit | a6b52fdc34650c74597c1bcdc5075b6375c62650 (patch) | |
tree | 93a9f3fe5139033e4c858adccaa635db1ed73a76 /test | |
parent | 2a58b44b8bdb802747ea6b908350cfb61dc75bb9 (diff) | |
parent | 83692360b1a3213fbe8a65b08b892980312b7ac1 (diff) | |
download | dexon-solidity-a6b52fdc34650c74597c1bcdc5075b6375c62650.tar.gz dexon-solidity-a6b52fdc34650c74597c1bcdc5075b6375c62650.tar.zst dexon-solidity-a6b52fdc34650c74597c1bcdc5075b6375c62650.zip |
Merge pull request #3550 from ethereum/offsetconstantsasm
Properly warn when using ``_offset`` and ``_slot`` for constants in inline assembly.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 2b102312..7c03d7cb 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -5776,6 +5776,21 @@ BOOST_AUTO_TEST_CASE(inline_assembly_storage_variable_access_out_of_functions) CHECK_SUCCESS_NO_WARNINGS(text); } +BOOST_AUTO_TEST_CASE(inline_assembly_constant_variable_via_offset) +{ + char const* text = R"( + contract test { + uint constant x = 2; + function f() pure public { + assembly { + let r := x_offset + } + } + } + )"; + CHECK_ERROR(text, TypeError, "Constant variables not supported by inline assembly."); +} + BOOST_AUTO_TEST_CASE(inline_assembly_calldata_variables) { char const* text = R"( |