diff --git a/Eigen/src/plugins/IndexedViewMethods.h b/Eigen/src/plugins/IndexedViewMethods.h index 27a26816d..b796b397f 100644 --- a/Eigen/src/plugins/IndexedViewMethods.h +++ b/Eigen/src/plugins/IndexedViewMethods.h @@ -97,7 +97,7 @@ operator()(const RowIndices& rowIndices, const ColIndices& colIndices) const { template std::enable_if_t::value && - internal::traits>::ReturnAsScalar, + internal::traits>::ReturnAsScalar && internal::is_lvalue::value, Scalar&> operator()(const RowIndices& rowIndices, const ColIndices& colIndices) { return Base::operator()(internal::eval_expr_given_size(rowIndices, rows()), @@ -174,7 +174,7 @@ operator()(const Indices& indices) const { } template -std::enable_if_t::value, Scalar&> operator()(const IndexType& id) { +std::enable_if_t::value && internal::is_lvalue::value, Scalar&> operator()(const IndexType& id) { return Base::operator()(internal::eval_expr_given_size(id, size())); }