From f650fe5e1247733189a65d2d44d05476517bf0a6 Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 5 May 2018 13:17:23 -0400 Subject: [PATCH] Fix a GCC8 warning. GCC warns that these types are not trivally copyable so we should not use std::memmove. We cannot use std::move either since the beginning of the new range may intersect the old range. Hence: use std::move_backward to copy from the end, which cannot overlap. --- include/deal.II/lac/constraint_matrix.templates.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/include/deal.II/lac/constraint_matrix.templates.h b/include/deal.II/lac/constraint_matrix.templates.h index 781173d749..4a6aa6172c 100644 --- a/include/deal.II/lac/constraint_matrix.templates.h +++ b/include/deal.II/lac/constraint_matrix.templates.h @@ -1062,9 +1062,12 @@ namespace internals // at least one element when we get here, subtracting 1 works fine. data.resize(2*data.size()); for (size_type i=individual_size.size()-1; i>0; --i) - std::memmove(&data[i*row_length*2], &data[i*row_length], - individual_size[i]* - sizeof(std::pair)); + { + const auto ptr = data.data(); + std::move_backward(ptr + i*row_length, + ptr + i*row_length + individual_size[i], + ptr + i*2*row_length + individual_size[i]); + } row_length *= 2; } data[index*row_length+my_length] = pair; -- 2.39.5