diff --git a/shardy/dialect/sdy/transforms/export/insert_explicit_reshards.cc b/shardy/dialect/sdy/transforms/export/insert_explicit_reshards.cc index 4eddef7..715f1e7 100644 --- a/shardy/dialect/sdy/transforms/export/insert_explicit_reshards.cc +++ b/shardy/dialect/sdy/transforms/export/insert_explicit_reshards.cc @@ -131,7 +131,8 @@ void insertExplicitReshards(Operation* op, const ShardingProjection& projection, } auto reshardOp = rewriter.create(value.getLoc(), value, newTensorSharding); - rewriter.modifyOpInPlace(op, [&]() { op->setOperand(index, reshardOp); }); + rewriter.modifyOpInPlace( + op, [&, index = index]() { op->setOperand(index, reshardOp); }); } rewriter.setInsertionPointAfter(op);