Skip to content

Commit

Permalink
Fixed -Wdeprecated-copy-dtor warnings by implementing a copy assignme…
Browse files Browse the repository at this point in the history
…nt 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]
  • Loading branch information
seanm committed Oct 13, 2022
1 parent 19312ee commit 7079439
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions c++/src/H5Attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,4 +628,14 @@ Attribute::~Attribute()
}
}

//--------------------------------------------------------------------------
// Function: Copy assignment operator
Attribute & Attribute::operator= (const Attribute &other)
{
if (&other != this) {
}

return *this;
}

} // namespace H5
3 changes: 3 additions & 0 deletions c++/src/H5Attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,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.
Expand Down
10 changes: 10 additions & 0 deletions c++/src/H5Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,14 @@ Group::~Group()
}
}

//--------------------------------------------------------------------------
// Function: Copy assignment operator
Group & Group::operator= (const Group &other)
{
if (&other != this) {
}

return *this;
}

} // namespace H5
3 changes: 3 additions & 0 deletions c++/src/H5Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,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);

Expand Down

0 comments on commit 7079439

Please sign in to comment.