On Thu, Jul 5, 2018 at 8:12 AM, Paul A. Bristow via Boost < boost@lists.boost.org> wrote:
Having failed to build Boost libraries using Clang 6.0.0 using b2/bjam on Windows, I am now trying instead to use Codeblocks on Windows 10 to build static libraries.
It comes to grief with these messages (the berbose gory details can be posted if anyone can help).
In file included from I:\modular-boost\boost/system/system_error.hpp:14: I:\modular-boost\boost/system/error_code.hpp:409:88: error: variable does not have a constant initializer template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT system_error_category cat_holder<T>::system_category_instance;
^~~~~~~~~~~~~~~~~~~~~~~~ I:\modular-boost\boost/system/error_code.hpp:409:19: note: required by 'require_constant_initialization' attribute here template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT system_error_category cat_holder<T>::system_category_instance; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I:\modular-boost\boost/system/error_code.hpp:392:44: note: expanded from macro 'BOOST_SYSTEM_REQUIRE_CONST_INIT' # define BOOST_SYSTEM_REQUIRE_CONST_INIT [[clang::require_constant_ initialization]] ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ This seems to be the ultimate cause
I:\modular-boost\boost/system/error_code.hpp:226:41: note: non-constexpr constructor 'error_category' cannot be used in a constant expression BOOST_SYSTEM_CONSTEXPR explicit std_category( boost::system::error_category const * pc ): pc_( pc )
Is this because BOOST_SYSTEM_CONSTEXPR should not be defined?
I note this in error_code.hpp
#if defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8) && __cplusplus
= 201700L // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83835 # undef BOOST_SYSTEM_HAS_CONSTEXPR #endif
should this undef list also include clang, and if so which versions 600?
I *suspect* that this is a red herring - but not having access to a Windows box, I don't know that. * Clang defines __GNUC__ to 4 (for compatibility reasons), so this #ifdef should never fire under clang. * This block of code is to work around a bug in gcc that clang doesn't have. -- Marshall