Fix pull request 17, 'some_function() noexcept = default;' from Antony Polukhin, by never relying on "= default". Antony's pull request would have fixed the problem interaction with noexcept by eliminating the noexcept. I preferred to retain the noexcept rather than the "= default", as applying "= default" has been exceedingly troublesome for both VC++ and GCC due to interactions between the two C++11 features. GCC interactions varied not just for the version, but also for the platform.

This commit is contained in:
Beman 2015-10-08 07:19:55 -04:00
parent 74c5f5fe3e
commit 06968ee032
4 changed files with 49 additions and 60 deletions

View File

@ -63,6 +63,7 @@
function to class <code>path</code>. Resolves
<a href="https://svn.boost.org/trac/boost/ticket/6874">#6874</a>, <i>Path
should have a size() member function</i>.</li>
<li>Clear several spurious GCC warnings.</li>
<li>Fix a race condition in <code>unique_path</code> by applying
<a href="https://github.com/boostorg/filesystem/pull/15">pull request #15</a>
from Sebastian Redl. Also fixes
@ -383,7 +384,7 @@
</ul>
<hr>
<p>Revised
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->17 September, 2015<!--webbot bot="Timestamp" endspan i-checksum="39351" --></p>
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->08 October, 2015<!--webbot bot="Timestamp" endspan i-checksum="38881" --></p>
<p>&copy; Copyright Beman Dawes, 2011</p>
<p> Use, modification, and distribution are subject to the Boost Software
License, Version 1.0. See <a href="http://www.boost.org/LICENSE_1_0.txt">

View File

@ -29,20 +29,6 @@
#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API
#include <boost/detail/workaround.hpp>
// BOOST_FILESYSTEM_NO_CXX11_DEFAULTED_RVALUE_REFS -----------------------------------//
//
// Both GCC and Microsoft shipped compiler versions that supported defaulted functions
// but they did not work as expected for rvalue references. GCC was particularly
// problematic because some versions worked on some platforms but not others; FreeBSD
// was failing as recently as GCC 4.8.5.
# if (defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) \
&& !defined(BOOST_FILESYSTEM_NO_CXX11_DEFAULTED_RVALUE_REFS)) \
|| (defined(__GNUC__) && __GNUC__ <= 4) \
|| (defined(_MSC_VER) && _MSC_VER==1800)
# define BOOST_FILESYSTEM_NO_CXX11_DEFAULTED_RVALUE_REFS
# endif
// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
# ifdef BOOST_FILESYSTEM_SOURCE

View File

@ -262,16 +262,20 @@ namespace boost
file_status(file_type v, perms prms) BOOST_NOEXCEPT
: m_value(v), m_perms(prms) {}
# ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
file_status(const file_status&) BOOST_NOEXCEPT = default;
file_status& operator=(const file_status&) BOOST_NOEXCEPT = default;
# endif
// As of October 2015 the interaction between noexcept and =default is so troublesome
// for VC++, GCC, and probably other compilers, that =default is not used with noexcept
// functions. GCC is not even consistent for the same release on different platforms.
file_status(const file_status& rhs) BOOST_NOEXCEPT
: m_value(rhs.m_value), m_perms(rhs.m_perms) {}
file_status& operator=(const file_status& rhs) BOOST_NOEXCEPT
{
m_value = rhs.m_value;
m_perms = rhs.m_perms;
return *this;
}
# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
# if !defined(BOOST_FILESYSTEM_NO_CXX11_DEFAULTED_RVALUE_REFS)
file_status(file_status&&) BOOST_NOEXCEPT = default;
file_status& operator=(file_status&&) BOOST_NOEXCEPT = default;
# else
file_status(file_status&& rhs) BOOST_NOEXCEPT
{
m_value = std::move(rhs.m_value);
@ -283,7 +287,6 @@ namespace boost
m_perms = std::move(rhs.m_perms);
return *this;
}
# endif
# endif
@ -743,44 +746,45 @@ class BOOST_FILESYSTEM_DECL directory_entry
public:
typedef boost::filesystem::path::value_type value_type; // enables class path ctor taking directory_entry
// compiler generated copy constructor, copy assignment, and destructor apply
directory_entry() BOOST_NOEXCEPT {}
explicit directory_entry(const boost::filesystem::path& p)
: m_path(p), m_status(file_status()), m_symlink_status(file_status())
{}
directory_entry(const boost::filesystem::path& p,
file_status st, file_status symlink_st = file_status())
: m_path(p), m_status(st), m_symlink_status(symlink_st)
{}
: m_path(p), m_status(st), m_symlink_status(symlink_st) {}
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
directory_entry(const directory_entry&) = default;
directory_entry& operator=(const directory_entry&) = default;
directory_entry(const directory_entry& rhs)
: m_path(rhs.m_path), m_status(rhs.m_status), m_symlink_status(rhs.m_symlink_status){}
directory_entry& operator=(const directory_entry& rhs)
{
m_path = rhs.m_path;
m_status = rhs.m_status;
m_symlink_status = rhs.m_symlink_status;
return *this;
}
// As of October 2015 the interaction between noexcept and =default is so troublesome
// for VC++, GCC, and probably other compilers, that =default is not used with noexcept
// functions. GCC is not even consistent for the same release on different platforms.
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
directory_entry(directory_entry&& rhs) BOOST_NOEXCEPT
{
m_path = std::move(rhs.m_path);
m_status = std::move(rhs.m_status);
m_symlink_status = std::move(rhs.m_symlink_status);
}
directory_entry& operator=(directory_entry&& rhs) BOOST_NOEXCEPT
{
m_path = std::move(rhs.m_path);
m_status = std::move(rhs.m_status);
m_symlink_status = std::move(rhs.m_symlink_status);
return *this;
}
#endif
# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
# if !defined(BOOST_FILESYSTEM_NO_CXX11_DEFAULTED_RVALUE_REFS)
directory_entry(directory_entry&&) BOOST_NOEXCEPT = default;
directory_entry& operator=(directory_entry&&) BOOST_NOEXCEPT = default;
# else
directory_entry(directory_entry&& rhs) BOOST_NOEXCEPT
{
m_path = std::move(rhs.m_path);
m_status = std::move(rhs.m_status);
m_symlink_status = std::move(rhs.m_symlink_status);
}
directory_entry& operator=(directory_entry&& rhs) BOOST_NOEXCEPT
{
m_path = std::move(rhs.m_path);
m_status = std::move(rhs.m_status);
m_symlink_status = std::move(rhs.m_symlink_status);
return *this;
}
# endif
# endif
void assign(const boost::filesystem::path& p,
file_status st = file_status(), file_status symlink_st = file_status())
{ m_path = p; m_status = st; m_symlink_status = symlink_st; }

View File

@ -148,16 +148,14 @@ namespace filesystem
path(const string_type& s) : m_pathname(s) {}
path(string_type& s) : m_pathname(s) {}
// As of October 2015 the interaction between noexcept and =default is so troublesome
// for VC++, GCC, and probably other compilers, that =default is not used with noexcept
// functions. GCC is not even consistent for the same release on different platforms.
# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
# if !defined(BOOST_FILESYSTEM_NO_CXX11_DEFAULTED_RVALUE_REFS)
path(path&&) BOOST_NOEXCEPT = default;
path& operator=(path&&) BOOST_NOEXCEPT = default;
# else
path(path&& p) BOOST_NOEXCEPT
{ m_pathname = std::move(p.m_pathname); }
path(path&& p) BOOST_NOEXCEPT { m_pathname = std::move(p.m_pathname); }
path& operator=(path&& p) BOOST_NOEXCEPT
{ m_pathname = std::move(p.m_pathname); return *this; }
# endif
# endif
template <class Source>