From 58b09face87ce04ac5bbda88888690693288fc5a Mon Sep 17 00:00:00 2001 From: David Wells Date: Sat, 11 Feb 2017 17:35:14 -0500 Subject: [PATCH] Make VectorBase::operator= private and undefined. This operator was formerly implicitly defined, which provides, almost surely, the wrong behavior since the underlying Vec will then be destroyed twice. Since both inheriting classes (Vector and MPI::Vector) define their own operator= overloads this operator is also not necessary. --- doc/news/changes/incompatibilities/20170211DavidWells | 10 ++++++++++ include/deal.II/lac/petsc_vector_base.h | 8 +++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 doc/news/changes/incompatibilities/20170211DavidWells diff --git a/doc/news/changes/incompatibilities/20170211DavidWells b/doc/news/changes/incompatibilities/20170211DavidWells new file mode 100644 index 0000000000..cfb16f0e03 --- /dev/null +++ b/doc/news/changes/incompatibilities/20170211DavidWells @@ -0,0 +1,10 @@ +Changed: PETScWrappers::VectorBase::operator= is now both private and +undefined. This operator was formerly implicitly defined (i.e., it did a +byte-for-byte copy of VectorBase's members), which provided, almost certainly, +the wrong behavior since the underlying Vec (the managed PETSc +object) would then be destroyed twice. Since both inheriting classes +(PETScWrappers::Vector and PETScWrappers::MPI::Vector) define their own +operator= overloads this operator is also not necessary. + +
+(David Wells, 2017/02/11) diff --git a/include/deal.II/lac/petsc_vector_base.h b/include/deal.II/lac/petsc_vector_base.h index 5be9d80363..cf7dac42b4 100644 --- a/include/deal.II/lac/petsc_vector_base.h +++ b/include/deal.II/lac/petsc_vector_base.h @@ -801,7 +801,13 @@ namespace PETScWrappers const PetscScalar *values, const bool add_values); - + private: + /** + * Assignment operator. This is currently not implemented, so it is + * deliberately left as private (and undefined) to prevent accidental + * usage. + */ + VectorBase &operator=(const VectorBase &); }; -- 2.39.5