[filesystem] path noncopyable error with boost 1.55.0 and g++ 4.5.1
I am trying to upgrade from Boost 1.52 to 1.55. Everything is fine with Clang 3.3, but I get this error with G++ 4.5.1: In file included from /netDISKS/master/netmt/LINUX_INTF14/cgi/boost/1.55.0/Include/libboost/boost/system/error_code.hpp:18:0, from /netDISKS/master/netmt/LINUX_INTF14/cgi/boost/1.55.0/Include/libboost/boost/filesystem/path_traits.hpp:23, from /netDISKS/master/netmt/LINUX_INTF14/cgi/boost/1.55.0/Include/libboost/boost/filesystem/path.hpp:25, from bssConfig.h:24, from bssConfig.cc:13: /netDISKS/master/netmt/LINUX_INTF14/cgi/boost/1.55.0/Include/libboost/boost/noncopyable.hpp:27:37: error: 'boost::noncopyable_::noncopyable::noncopyable()' declared with non-public access cannot be defaulted in the class body /netDISKS/master/netmt/LINUX_INTF14/cgi/boost/1.55.0/Include/libboost/boost/noncopyable.hpp:28:22: error: 'boost::noncopyable_::noncopyable::~noncopyable()' declared with non-public access cannot be defaulted in the class body The OS is Linux Fedora 14. The compiler is gcc version 4.5.1 20100924 (Red Hat 4.5.1-4). I am compiling with these flags: -march=core2 -msse4.1 -m64 -mpc64 -std=c++0x -pedantic-errors -mieee-fp -fPIC -pthread -O2 -g -fno-strict-aliasing -fno-tree-ccp -- Dick Hadsell 203-992-6320 Fax: 203-992-6001 Reply-to: hadsell@blueskystudios.com Blue Sky Studioshttp://www.blueskystudios.com 1 American Lane, Greenwich, CT 06831-2560 Follow Blue Sky Studios on Facebook http://www.facebook.com/BlueSkyStudios and Twitter http://twitter.com/#%21/blueskystudios
On 9 April 2014 16:23, Richard Hadsell wrote:
The compiler is gcc version 4.5.1 20100924 (Red Hat 4.5.1-4).
I am compiling with these flags:
-march=core2 -msse4.1 -m64 -mpc64 -std=c++0x -pedantic-errors -mieee-fp -fPIC -pthread -O2 -g -fno-strict-aliasing -fno-tree-ccp
C++0x support in GCC 4.5 was ... primitive, at best. It certainly wasn't close to the C++11 standard, because there was not C++11 standard. IMHO you get what you asked for if you try to use a highly experimental language mode of an old compiler with a modern version of Boost.
On Wednesday 09 April 2014 16:56:42 Jonathan Wakely wrote:
On 9 April 2014 16:23, Richard Hadsell wrote:
The compiler is gcc version 4.5.1 20100924 (Red Hat 4.5.1-4).
I am compiling with these flags:
-march=core2 -msse4.1 -m64 -mpc64 -std=c++0x -pedantic-errors -mieee-fp -fPIC -pthread -O2 -g -fno-strict-aliasing -fno-tree-ccp
C++0x support in GCC 4.5 was ... primitive, at best. It certainly wasn't close to the C++11 standard, because there was not C++11 standard. IMHO you get what you asked for if you try to use a highly experimental language mode of an old compiler with a modern version of Boost.
FWIW, there is BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS macro in Boost.Config just for this case. BOOST_DEFAULTED_FUNCTION takes it into account.
On 04/09/2014 12:41 PM, Andrey Semashev wrote:
FWIW, there is BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS macro in Boost.Config just for this case. BOOST_DEFAULTED_FUNCTION takes it into account.
That's a good pointer. I will change noncopyable.hpp to include this flag: +++ boost/noncopyable.hpp 9 Apr 2014 17:05:09 -0000 @@ -23,7 +23,7 @@ class noncopyable { protected: -#ifndef BOOST_NO_DEFAULTED_FUNCTIONS +#if !defined(BOOST_NO_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS) BOOST_CONSTEXPR noncopyable() = default; ~noncopyable() = default; #else Another possible fix would be to use BOOST_DEFAULTED_FUNCTION for the constructor and destructor, but I'm not sure what happens to 'BOOST_CONSTEXPR', which is not included with the '#else' version of the constructor. So, I'll try out the safer fix I suggested. I also didn't replace BOOST_NO_DEFAULTED_FUNCTIONS with BOOST_NO_CXX11_DEFAULTED_FUNCTIONS, not knowing the current preference. Anyway, I leave it to you to decide how to fix noncopyable.hpp for this minor incompatibility with an ancient compiler. Since BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS exists, it seems reasonable to use it where appropriate.
On Wednesday 09 April 2014 13:28:16 Richard Hadsell wrote:
I also didn't replace BOOST_NO_DEFAULTED_FUNCTIONS with BOOST_NO_CXX11_DEFAULTED_FUNCTIONS, not knowing the current preference.
BOOST_NO_DEFAULTED_FUNCTIONS is deprecated, BOOST_NO_CXX11_DEFAULTED_FUNCTIONS should be used instead.
Anyway, I leave it to you to decide how to fix noncopyable.hpp for this minor incompatibility with an ancient compiler. Since BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS exists, it seems reasonable to use it where appropriate.
I'm fine with either approach. Using BOOST_NO_CXX11_DEFAULTED_FUNCTIONS and BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS seems more natural in this particular case.
participants (3)
-
Andrey Semashev
-
Jonathan Wakely
-
Richard Hadsell