diff --git a/dune/solvers/common/algorithm.hh b/dune/solvers/common/algorithm.hh
index fbb84469e3b890d4327f812763b21cad7757907e..20532fcf7a6f954a59e0a58b5c83a860387f578b 100644
--- a/dune/solvers/common/algorithm.hh
+++ b/dune/solvers/common/algorithm.hh
@@ -425,8 +425,8 @@ template<class Index, class Begin, class End, class F, class... Args,
     std::enable_if_t<IsIntegralConstant<Begin>::value and IsIntegralConstant<End>::value, int> = 0>
 void integralRangeFor(Begin&& begin, End&& end, F&& f, Args&&... args)
 {
-  static const Index begin_t = begin;
-  static const Index end_t = end;
+  static const Index begin_t = std::decay_t<Begin>::value;
+  static const Index end_t = std::decay_t<End>::value;
   StaticForLoop<Index, begin_t, end_t>::apply(std::forward<F>(f), std::forward<Args>(args)...);
 }