From: David Wells Date: Sat, 5 May 2018 17:17:23 +0000 (-0400) Subject: Fix a GCC8 warning. X-Git-Tag: v9.0.0-rc3~6^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f650fe5e1247733189a65d2d44d05476517bf0a6;p=dealii.git 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. --- 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;