Fix more gcc compiler warnings / sort-of bugs
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index 5805763..dad2af8 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -357,7 +357,7 @@
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
BlockImpl_dense(XprType& xpr, Index i)
- : Base(add_to_nullable_pointer(xpr.data(),
+ : Base((BlockRows == 0 || BlockCols == 0) ? nullptr : add_to_nullable_pointer(xpr.data(),
i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor))
|| ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride())),
BlockRows==1 ? 1 : xpr.rows(),
@@ -373,7 +373,7 @@
*/
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
BlockImpl_dense(XprType& xpr, Index startRow, Index startCol)
- : Base(add_to_nullable_pointer(xpr.data(),
+ : Base((BlockRows == 0 || BlockCols == 0) ? nullptr : add_to_nullable_pointer(xpr.data(),
xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol))),
m_xpr(xpr), m_startRow(startRow), m_startCol(startCol)
{
@@ -386,7 +386,7 @@
BlockImpl_dense(XprType& xpr,
Index startRow, Index startCol,
Index blockRows, Index blockCols)
- : Base(add_to_nullable_pointer(xpr.data(),
+ : Base((blockRows == 0 || blockCols == 0) ? nullptr : add_to_nullable_pointer(xpr.data(),
xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol)),
blockRows, blockCols),
m_xpr(xpr), m_startRow(startRow), m_startCol(startCol)
diff --git a/Eigen/src/Core/VectorBlock.h b/Eigen/src/Core/VectorBlock.h
index ee28da1..2715a1e 100644
--- a/Eigen/src/Core/VectorBlock.h
+++ b/Eigen/src/Core/VectorBlock.h
@@ -69,8 +69,7 @@
public:
EIGEN_DENSE_PUBLIC_INTERFACE(VectorBlock)
EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorBlock)
-
- using Base::operator=;
+ EIGEN_INHERIT_ASSIGNMENT_OPERATORS(VectorBlock)
/** Dynamic-size constructor
*/
diff --git a/test/block.cpp b/test/block.cpp
index f8583c3..aba0896 100644
--- a/test/block.cpp
+++ b/test/block.cpp
@@ -40,14 +40,14 @@
std::enable_if_t<((MatrixType::Flags&RowMajorBit)==0),void>
check_left_top(const MatrixType& m, Index r, Index c,
Index rows, Index /*unused*/) {
- VERIFY_IS_EQUAL(m.leftCols(c).coeff(r+c*rows), m(r,c));
+ if(c > 0) VERIFY_IS_EQUAL(m.leftCols(c).coeff(r+c*rows), m(r,c));
}
template <typename MatrixType>
std::enable_if_t<((MatrixType::Flags&RowMajorBit)!=0),void>
check_left_top(const MatrixType& m, Index r, Index c,
Index /*unused*/, Index cols) {
- VERIFY_IS_EQUAL(m.topRows(r).coeff(c+r*cols), m(r,c));
+ if(r > 0) VERIFY_IS_EQUAL(m.topRows(r).coeff(c+r*cols), m(r,c));
}
template<typename MatrixType> void block(const MatrixType& m)
diff --git a/test/random_matrix.cpp b/test/random_matrix.cpp
index 873845f..a914af1 100644
--- a/test/random_matrix.cpp
+++ b/test/random_matrix.cpp
@@ -63,7 +63,7 @@
{
RealVectorType svs = setupRangeSvs<RealVectorType, RealScalar>(diag_size, min_svs, max_svs);
- MatrixType M;
+ MatrixType M = MatrixType::Zero(rows, cols);
generateRandomMatrixSvs(svs, rows, cols, M);
// validate dimensions
diff --git a/test/triangular.cpp b/test/triangular.cpp
index 2259869..0578b08 100644
--- a/test/triangular.cpp
+++ b/test/triangular.cpp
@@ -55,6 +55,7 @@
r1(rows, cols),
r2(rows, cols);
VectorType v2 = VectorType::Random(rows);
+ VectorType v3 = VectorType::Zero(rows);
MatrixType m1up = m1.template triangularView<Upper>();
MatrixType m2up = m2.template triangularView<Upper>();
@@ -96,23 +97,31 @@
Transpose<MatrixType> trm4(m4);
// test back and forward substitution with a vector as the rhs
m3 = m1.template triangularView<Upper>();
- VERIFY(v2.isApprox(m3.adjoint() * (m1.adjoint().template triangularView<Lower>().solve(v2)), largerEps));
+ v3 = m3.adjoint() * (m1.adjoint().template triangularView<Lower>().solve(v2));
+ VERIFY(v2.isApprox(v3, largerEps));
m3 = m1.template triangularView<Lower>();
- VERIFY(v2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(v2)), largerEps));
+ v3 = m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(v2));
+ VERIFY(v2.isApprox(v3, largerEps));
m3 = m1.template triangularView<Upper>();
- VERIFY(v2.isApprox(m3 * (m1.template triangularView<Upper>().solve(v2)), largerEps));
+ v3 = m3 * (m1.template triangularView<Upper>().solve(v2));
+ VERIFY(v2.isApprox(v3, largerEps));
m3 = m1.template triangularView<Lower>();
- VERIFY(v2.isApprox(m3.conjugate() * (m1.conjugate().template triangularView<Lower>().solve(v2)), largerEps));
+ v3 = m3.conjugate() * (m1.conjugate().template triangularView<Lower>().solve(v2));
+ VERIFY(v2.isApprox(v3, largerEps));
// test back and forward substitution with a matrix as the rhs
m3 = m1.template triangularView<Upper>();
- VERIFY(m2.isApprox(m3.adjoint() * (m1.adjoint().template triangularView<Lower>().solve(m2)), largerEps));
+ m4 = m3.adjoint() * (m1.adjoint().template triangularView<Lower>().solve(m2));
+ VERIFY(m2.isApprox(m4, largerEps));
m3 = m1.template triangularView<Lower>();
- VERIFY(m2.isApprox(m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(m2)), largerEps));
+ m4 = m3.transpose() * (m1.transpose().template triangularView<Upper>().solve(m2));
+ VERIFY(m2.isApprox(m4, largerEps));
m3 = m1.template triangularView<Upper>();
- VERIFY(m2.isApprox(m3 * (m1.template triangularView<Upper>().solve(m2)), largerEps));
+ m4 = m3 * (m1.template triangularView<Upper>().solve(m2));
+ VERIFY(m2.isApprox(m4, largerEps));
m3 = m1.template triangularView<Lower>();
- VERIFY(m2.isApprox(m3.conjugate() * (m1.conjugate().template triangularView<Lower>().solve(m2)), largerEps));
+ m4 = m3.conjugate() * (m1.conjugate().template triangularView<Lower>().solve(m2));
+ VERIFY(m2.isApprox(m4, largerEps));
// check M * inv(L) using in place API
m4 = m3;