From 9ef637630869ec4c2f7d66030771f639f93bb10f Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 28 Jun 2022 17:16:04 -0400 Subject: [PATCH] Fixed -Wdeprecated-copy-dtor warnings by implementing a copy assignment operator Example warning was: warning: definition of implicit copy assignment operator for 'Group' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] --- c++/src/H5Attribute.cpp | 10 ++++++++++ c++/src/H5Attribute.h | 3 +++ c++/src/H5Group.cpp | 10 ++++++++++ c++/src/H5Group.h | 3 +++ 4 files changed, 26 insertions(+) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index e838b4ffb4d..4df96d46d77 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -605,4 +605,14 @@ Attribute::~Attribute() } } +//-------------------------------------------------------------------------- +// Function: Copy assignment operator +Attribute & Attribute::operator= (const Attribute &other) +{ + if (&other != this) { + } + + return *this; +} + } // namespace H5 diff --git a/c++/src/H5Attribute.h b/c++/src/H5Attribute.h index 6851e1ac765..f50281ea83f 100644 --- a/c++/src/H5Attribute.h +++ b/c++/src/H5Attribute.h @@ -78,6 +78,9 @@ class H5_DLLCPP Attribute : public AbstractDs, public H5Location { // Destructor: properly terminates access to this attribute. virtual ~Attribute() override; + // Copy assignment operator. + Attribute & operator= (const Attribute &other); + #ifndef DOXYGEN_SHOULD_SKIP_THIS protected: // Sets the attribute id. diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 35e9d26bfa3..2c51f2c9ce5 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -274,4 +274,14 @@ Group::~Group() } } +//-------------------------------------------------------------------------- +// Function: Copy assignment operator +Group & Group::operator= (const Group &other) +{ + if (&other != this) { + } + + return *this; +} + } // namespace H5 diff --git a/c++/src/H5Group.h b/c++/src/H5Group.h index cb9b0920f84..0a52f81adcd 100644 --- a/c++/src/H5Group.h +++ b/c++/src/H5Group.h @@ -67,6 +67,9 @@ class H5_DLLCPP Group : public H5Object, public CommonFG { // Destructor virtual ~Group() override; + // Copy assignment operator. + Group & operator= (const Group &other); + // Creates a copy of an existing group using its id. Group(const hid_t group_id);