From 5405e58a9a32e4daeb6070e3162c34cd939fc1b0 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Mon, 25 Oct 2021 12:11:25 -0600 Subject: [PATCH] Make sure we only write into variables that are non-const. --- tests/data_out/patches.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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) = -- 2.39.5