Skip to content

Commit

Permalink
Use BOOST_DEFAULTED_FUNCTION on empty destructors
Browse files Browse the repository at this point in the history
The compiler-generated copy constructor and copy assignment operator are deprecated since C++11 on classes with user-declared destructors.

This change allows clean compilation with the -Wdeprecated-copy-dtor/-Wdeprecated-copy-with-user-provided-dtor flag.
  • Loading branch information
ecatmur committed Feb 22, 2023
1 parent 88a3b0b commit d114fed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
12 changes: 0 additions & 12 deletions include/boost/property_tree/detail/exception_implementation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ namespace boost { namespace property_tree
{
}

inline ptree_error::~ptree_error() throw()
{
}

///////////////////////////////////////////////////////////////////////////
// ptree_bad_data

Expand All @@ -48,10 +44,6 @@ namespace boost { namespace property_tree
{
}

inline ptree_bad_data::~ptree_bad_data() throw()
{
}

template<class D> inline
D ptree_bad_data::data() const
{
Expand All @@ -68,10 +60,6 @@ namespace boost { namespace property_tree

}

inline ptree_bad_path::~ptree_bad_path() throw()
{
}

template<class P> inline
P ptree_bad_path::path() const
{
Expand Down
4 changes: 2 additions & 2 deletions include/boost/property_tree/detail/file_parser_error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ namespace boost { namespace property_tree
{
}

~file_parser_error() throw() BOOST_OVERRIDE
BOOST_DEFAULTED_FUNCTION(~file_parser_error() throw() BOOST_OVERRIDE,
// gcc 3.4.2 complains about lack of throw specifier on compiler
// generated dtor
{
}
})

///////////////////////////////////////////////////////////////////////
// Data access
Expand Down
6 changes: 3 additions & 3 deletions include/boost/property_tree/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ namespace boost { namespace property_tree
/// @param what The message to associate with this error.
ptree_error(const std::string &what);

~ptree_error() throw() BOOST_OVERRIDE;
BOOST_DEFAULTED_FUNCTION(~ptree_error() throw() BOOST_OVERRIDE, {});
};


Expand All @@ -48,7 +48,7 @@ namespace boost { namespace property_tree
template<class T> ptree_bad_data(const std::string &what,
const T &data);

~ptree_bad_data() throw() BOOST_OVERRIDE;
BOOST_DEFAULTED_FUNCTION(~ptree_bad_data() throw() BOOST_OVERRIDE, {});

/// Retrieve the data associated with this error. This is the source
/// value that failed to be translated. You need to explicitly
Expand All @@ -70,7 +70,7 @@ namespace boost { namespace property_tree
template<class T> ptree_bad_path(const std::string &what,
const T &path);

~ptree_bad_path() throw() BOOST_OVERRIDE;
BOOST_DEFAULTED_FUNCTION(~ptree_bad_path() throw() BOOST_OVERRIDE, {});

/// Retrieve the invalid path. You need to explicitly specify the
/// type of path.
Expand Down

0 comments on commit d114fed

Please sign in to comment.