diff --git a/dumux/porousmediumflow/fluxvariablescachefiller.hh b/dumux/porousmediumflow/fluxvariablescachefiller.hh
index 336dabc5828512c7ad7213eb618224e166d889c5..6e53a931c154922e6a874790eb3de4a6b4794dc3 100644
--- a/dumux/porousmediumflow/fluxvariablescachefiller.hh
+++ b/dumux/porousmediumflow/fluxvariablescachefiller.hh
@@ -616,7 +616,7 @@ private:
                 if (forceUpdateAll || diffusionIsSolDependent)
                 {
                     // lambda to obtain diffusion coefficient
-                    const auto getD = [phaseIdx, compIdx] (const auto& volVars)
+                    const auto getD = [&](const auto& volVars)
                     {
                         if constexpr (FluidSystem::isTracerFluidSystem())
                             return volVars.effectiveDiffusionCoefficient(0, 0, compIdx);