diff --git a/dune/istl/ilu.hh b/dune/istl/ilu.hh
index f7557d29f329a88031c7b7b50d161c37f13f6955..edf2380744031fc071477fc9984c97ef8652f7d6 100644
--- a/dune/istl/ilu.hh
+++ b/dune/istl/ilu.hh
@@ -188,7 +188,9 @@ namespace Dune {
           coliterator kj = ILU[(*ik).first].find((*ik).first);                       // diagonal in k
           for (++kj; kj!=endk; ++kj)                       // row k eliminates in row i
           {
-            int generation = (int) firstmatrixelement(*kj);
+            // we misuse the storage to store an int. If the field_type is std::complex, we have to access the real part
+            // starting from C++11, we can use std::real to always return a real value, even if it is double/float
+            int generation = (int) std::real( firstmatrixelement(*kj) );
             if (generation<n)
             {
               mapiterator ij = rowpattern.find(kj.index());