diff --git a/dune/subgrid/subgrid/subgridgeometry.hh b/dune/subgrid/subgrid/subgridgeometry.hh
index cc89551c63fa3f7d9b97e414ddf49b5a877b0edd..578ca06328afd5d4d24e7543e45b28124259296b 100644
--- a/dune/subgrid/subgrid/subgridgeometry.hh
+++ b/dune/subgrid/subgrid/subgridgeometry.hh
@@ -233,12 +233,12 @@ class SubGridLocalGeometry
 
         //! The Jacobian matrix of the mapping from the reference element to this element
         const JacobianTransposed jacobianTransposed (const FieldVector<ctype, mydim>& local) const {
-            return Std::visit([&](auto&& geom) {return geom.jacobianTransposed(local);}, localGeometry_);
+            return Std::visit([&](auto&& geom) {return static_cast<JacobianTransposed>(geom.jacobianTransposed(local));}, localGeometry_);
         }
 
         //! The inverse of the Jacobian matrix of the mapping from the reference element to this element
         const JacobianInverseTransposed jacobianInverseTransposed (const FieldVector<ctype, mydim>& local) const {
-            return Std::visit([&](auto&& geom) {return geom.jacobianInverseTransposed(local);}, localGeometry_);
+            return Std::visit([&](auto&& geom) {return static_cast<JacobianInverseTransposed>(geom.jacobianInverseTransposed(local));}, localGeometry_);
         }
 
     private: