From: David Wells Date: Sat, 11 Feb 2017 22:35:14 +0000 (-0500) Subject: Make VectorBase::operator= private and undefined. X-Git-Tag: v8.5.0-rc1~119^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=58b09face87ce04ac5bbda88888690693288fc5a;p=dealii.git 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. --- 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 &); };