diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 489269a63..e4b0cb8e3 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -2918,10 +2918,7 @@ void IRGeneratorForStatements::setLValue(Expression const& _expression, IRLValue solAssert(!m_currentLValue, ""); if (_expression.annotation().willBeWrittenTo) - { m_currentLValue.emplace(std::move(_lvalue)); - solAssert(!_lvalue.type.dataStoredIn(DataLocation::CallData), ""); - } else // Only define the expression, if it will not be written to. define(_expression, readFromLValue(_lvalue)); diff --git a/test/libsolidity/semanticTests/array/slices/array_calldata_assignment.sol b/test/libsolidity/semanticTests/array/slices/array_calldata_assignment.sol new file mode 100644 index 000000000..5bb12e892 --- /dev/null +++ b/test/libsolidity/semanticTests/array/slices/array_calldata_assignment.sol @@ -0,0 +1,10 @@ +contract C { + function f(uint256[] calldata x, uint256[] calldata y, uint256 i) external returns (uint256) { + x = y; + return x[i]; + } +} +// ==== +// compileViaYul: also +// ---- +// f(uint256[], uint256[], uint256): 0x60, 0xA0, 1, 1, 0, 2, 1, 2 -> 2 \ No newline at end of file