diff --git a/dune/istl/foreach.hh b/dune/istl/foreach.hh index 4e9464db1a1e29de0ea8e5a7c481d02438c7b41f..4cb3e90052bb2aaced0f780bba2b041d5565f143 100644 --- a/dune/istl/foreach.hh +++ b/dune/istl/foreach.hh @@ -167,8 +167,12 @@ std::pair<std::size_t,std::size_t> flatMatrixForEach(Matrix&& matrix, F&& f, std { auto&& entry = *colIt; auto colIdx = colIt.index(); - auto [ dummyRows, dummyCols ] = flatMatrixForEach(entry, f, rowOffset + rowIdx*blockRows, colOffset + colIdx*blockCols); - assert( dummyRows == blockRows and dummyCols == blockCols and "we need the same size of each block in this matrix type"); +#ifndef NDEBUG + // only instantiate return value in debug mode (for the assert) + auto [ numRows, numCols ] = +#endif + flatMatrixForEach(entry, f, rowOffset + rowIdx*blockRows, colOffset + colIdx*blockCols); + assert( numRows == blockRows and numCols == blockCols and "we need the same size of each block in this matrix type"); } }