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 Jul 28, 2023
1 parent 800edda commit 9ef6376
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 @@ -605,4 +605,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 @@ -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.
Expand Down
10 changes: 10 additions & 0 deletions c++/src/H5Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,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 @@ -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);

Expand Down

0 comments on commit 9ef6376

Please sign in to comment.