From 25424d91f60a9f858e7dc1c7936021cc1dd72019 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 26 Aug 2020 12:32:20 +0200 Subject: Fix #1974: assertion when reserving an empty sparse matrix --- test/sparse_basic.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test/sparse_basic.cpp') diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp index 9e735b38b..5f8762172 100644 --- a/test/sparse_basic.cpp +++ b/test/sparse_basic.cpp @@ -662,6 +662,14 @@ template void sparse_basic(const SparseMatrixType& re iters[0] = IteratorType(m2,0); iters[1] = IteratorType(m2,m2.outerSize()-1); } + + // test reserve with empty rows/columns + { + SparseMatrixType m1(0,cols); + m1.reserve(ArrayXi::Constant(m1.outerSize(),1)); + SparseMatrixType m2(rows,0); + m2.reserve(ArrayXi::Constant(m2.outerSize(),1)); + } } -- cgit v1.2.3