diff options
author | Rasmus Munk Larsen <rmlarsen@google.com> | 2021-06-22 14:31:32 +0000 |
---|---|---|
committer | Antonio Sánchez <cantonios@google.com> | 2021-06-22 14:31:32 +0000 |
commit | 4ad30a73fc8b707bf90b9ec712a12a7f63ae823a (patch) | |
tree | cd59a12061dca031af2b09b99cb78b1b94e62c4b | |
parent | ea62c937edcc2c5efdaccfb6813ca39f48564ece (diff) |
Use internal::ref_selector to avoid holding a reference to a RHS expression.
-rw-r--r-- | Eigen/src/Core/Solve.h | 2 | ||||
-rw-r--r-- | test/solverbase.h | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/Eigen/src/Core/Solve.h b/Eigen/src/Core/Solve.h index 23d5cb707..af30fcec2 100644 --- a/Eigen/src/Core/Solve.h +++ b/Eigen/src/Core/Solve.h @@ -77,7 +77,7 @@ public: protected: const Decomposition &m_dec; - const RhsType &m_rhs; + const typename internal::ref_selector<RhsType>::type m_rhs; }; diff --git a/test/solverbase.h b/test/solverbase.h index 13c09593a..ba76ba4ee 100644 --- a/test/solverbase.h +++ b/test/solverbase.h @@ -31,6 +31,10 @@ void check_solverbase(const MatrixType& matrix, const SolverType& solver, Index solver_solution2 = RhsType::Random(rows,cols2); solver_solution2 = solver.adjoint().solve(m2); VERIFY_IS_APPROX(m2, matrix.adjoint()*solver_solution2); + // test with temporary expression as rhs + m2 = DstType::Random(cols,cols2); + solver_solution = solver.solve(matrix*m2); + VERIFY_IS_APPROX(matrix*m2, matrix*solver_solution); } #endif // TEST_SOLVERBASE_H |