From: Wolfgang Bangerth Date: Mon, 25 Oct 2021 18:11:25 +0000 (-0600) Subject: Make sure we only write into variables that are non-const. X-Git-Tag: v9.4.0-rc1~879^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5405e58a9a32e4daeb6070e3162c34cd939fc1b0;p=dealii.git Make sure we only write into variables that are non-const. --- diff --git a/tests/data_out/patches.h b/tests/data_out/patches.h index 0f6269e12f..6636d7a22a 100644 --- a/tests/data_out/patches.h +++ b/tests/data_out/patches.h @@ -34,8 +34,15 @@ create_patches(std::vector> &patches) const unsigned int nsub = p + 1; const unsigned int nsubp = nsub + 1; - patch.n_subdivisions = nsub; -#if DEAL_II_HAVE_CXX17 +#ifdef DEAL_II_HAVE_CXX17 + if constexpr (dim > 0) + patch.n_subdivisions = nsub; +#else + if (dim > 0) + const_cast(patch.n_subdivisions) = nsub; +#endif + +#ifdef DEAL_II_HAVE_CXX17 if constexpr (dim > 0) patch.reference_cell = ReferenceCells::get_hypercube(); #else @@ -43,6 +50,7 @@ create_patches(std::vector> &patches) const_cast(patch.reference_cell) = ReferenceCells::get_hypercube(); #endif + for (const unsigned int v : GeometryInfo::vertex_indices()) for (unsigned int d = 0; d < spacedim; ++d) patch.vertices[v](d) =