Boost logo

Boost :

Subject: Re: [boost] Clang 600 and BOOST_SYSTEM_CONSTEXPR causes error_code.hpp compile failure.
From: Peter Dimov (lists_at_[hidden])
Date: 2018-07-07 17:14:31

Paul A. Bristow 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.

I'll need more information than that, because the tests for System pass on
Clang 6 on Travis.

> 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;

This path is only entered when BOOST_ERROR_CODE_HEADER_ONLY is defined, by
the way.

> 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 )

Either `BOOST_SYSTEM_CONSTEXPR` is not defined to `constexpr` - which
doesn't make sense because otherwise line 409 won't be reached - or there's
something else going on and the complete error log might help.

> Is this because BOOST_SYSTEM_CONSTEXPR should not be defined?

It should be, for C++14 or later.

> I note this in error_code.hpp
> #if defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8) && __cplusplus
> >= 201700L

This is now

#if defined(__GNUC__) && (__GNUC__ == 7 && __GNUC_MINOR__ < 4) &&
__cplusplus >= 201700L

because the GCC bug has been fixed for 7.4 and 8.1.

> should this undef list also include clang, and if so which versions 600?


Boost list run by bdawes at, gregod at, cpdaniel at, john at