|
Boost : |
Subject: Re: [boost] Clang 600 and BOOST_SYSTEM_CONSTEXPR causes error_code.hpp compile failure.
From: John Maddock (jz.maddock_at_[hidden])
Date: 2018-07-08 10:26:43
On 07/07/2018 18:14, Peter Dimov via Boost wrote:
> 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.
>
> https://travis-ci.org/boostorg/system/jobs/398224285
It's the windows build that's the issue, not Linux.
Compiling from within the VC IDE using the clang installed LLVM-2014
toolset, and the full command line options:
/GS /GL /W3 /Gy /Zc:wchar_t /I"m:\data\boost\boost" /Zi /Gm- /O2
/Fd"x64\Release\system.pdb" /Zc:inline /fp:precise /D "NDEBUG" /D "_LIB"
/D "_UNICODE" /D "UNICODE" /errorReport:prompt /WX- /Zc:forScope /Gd /Oi
/MD /Fa"x64\Release\" /EHsc /nologo /Fo"x64\Release\"
/Fp"x64\Release\system.pch"
I see:
1>clang-cl.exe : warning : argument unused during compilation: '/Gm-'
[-Wunused-command-line-argument]
1>In file included from ..\..\..\..\libs\system\src\error_code.cpp:16:
1>m:\data\boost\boost\boost/system/error_code.hpp(226,41): error :
constexpr constructor never produces a constant expression
[-Winvalid-constexpr]
1>Â Â Â Â Â Â Â BOOST_SYSTEM_CONSTEXPR explicit std_category(
boost::system::error_category const * pc ): pc_( pc )
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>m:\data\boost\boost\boost/system/error_code.hpp(226,41):Â note:
non-constexpr constructor 'error_category' cannot be used in a constant
expression
1>C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\system_error(168,18):Â note: declared here
1>Â Â Â Â Â Â Â /* constexpr */ error_category() _NOEXCEPTÂ Â Â Â Â // TRANSITION
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>In file included from ..\..\..\..\libs\system\src\error_code.cpp:19:
1>m:\data\boost\boost\boost/system/detail/error_code.ipp(78,33): warning
: 'strerror' is deprecated: This function or variable may be unsafe.
Consider using strerror_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
[-Wdeprecated-declarations]
1>Â Â Â Â Â const char * c_str = std::strerror( ev );
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>C:\Program Files (x86)\Windows
Kits\10\Include\10.0.16299.0\ucrt\string.h(180,16):Â note: 'strerror'
has been explicitly marked deprecated here
1>_Check_return_ _CRT_INSECURE_DEPRECATE(strerror_s)
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\vcruntime.h(269,55):Â note: expanded from macro
'_CRT_INSECURE_DEPRECATE'
1>Â Â Â Â Â Â Â #define _CRT_INSECURE_DEPRECATE(_Replacement)
_CRT_DEPRECATE_TEXT(Â Â Â \
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\vcruntime.h(259,47):Â note: expanded from macro
'_CRT_DEPRECATE_TEXT'
1>#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated(_Text))
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>In file included from ..\..\..\..\libs\system\src\error_code.cpp:19:
1>m:\data\boost\boost\boost/system/detail/error_code.ipp(458,73): error
: variable does not have a constant initializer
1>BOOST_SYSTEM_REQUIRE_CONST_INIT BOOST_SYSTEM_DECL
system_error_category system_category_instance;
1> ^~~~~~~~~~~~~~~~~~~~~~~~
1>m:\data\boost\boost\boost/system/detail/error_code.ipp(458,1): note:
required by 'require_constant_initialization' attribute here
1>BOOST_SYSTEM_REQUIRE_CONST_INIT BOOST_SYSTEM_DECL
system_error_category system_category_instance;
1>^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>m:\data\boost\boost\boost/system/error_code.hpp(392,44):Â note:
expanded from macro 'BOOST_SYSTEM_REQUIRE_CONST_INIT'
1># define BOOST_SYSTEM_REQUIRE_CONST_INIT
[[clang::require_constant_initialization]]
1> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>m:\data\boost\boost\boost/system/error_code.hpp(226,41):Â note:
non-constexpr constructor 'error_category' cannot be used in a constant
expression
1>Â Â Â Â Â Â Â BOOST_SYSTEM_CONSTEXPR explicit std_category(
boost::system::error_category const * pc ): pc_( pc )
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>m:\data\boost\boost\boost/system/error_code.hpp(252,70):Â note: in
call to 'std_category(&system_category_instance)'
1>Â Â Â Â Â BOOST_SYSTEM_CONSTEXPR error_category() BOOST_SYSTEM_NOEXCEPT:
std_cat_( this ) {}
1> ^
1>m:\data\boost\boost\boost/system/error_code.hpp(370,28):Â note: in
call to 'error_category()'
1>Â Â Â BOOST_SYSTEM_CONSTEXPR system_error_category() BOOST_SYSTEM_NOEXCEPT
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>m:\data\boost\boost\boost/system/detail/error_code.ipp(458,73): note:
in call to 'system_error_category()'
1>BOOST_SYSTEM_REQUIRE_CONST_INIT BOOST_SYSTEM_DECL
system_error_category system_category_instance;
1> ^
1>C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\system_error(168,18):Â note: declared here
1>Â Â Â Â Â Â Â /* constexpr */ error_category() _NOEXCEPTÂ Â Â Â Â // TRANSITION
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>In file included from ..\..\..\..\libs\system\src\error_code.cpp:19:
1>m:\data\boost\boost\boost/system/detail/error_code.ipp(459,74): error
: variable does not have a constant initializer
1>BOOST_SYSTEM_REQUIRE_CONST_INIT BOOST_SYSTEM_DECL
generic_error_category generic_category_instance;
1> ^~~~~~~~~~~~~~~~~~~~~~~~~
1>m:\data\boost\boost\boost/system/detail/error_code.ipp(459,1): note:
required by 'require_constant_initialization' attribute here
1>BOOST_SYSTEM_REQUIRE_CONST_INIT BOOST_SYSTEM_DECL
generic_error_category generic_category_instance;
1>^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>m:\data\boost\boost\boost/system/error_code.hpp(392,44):Â note:
expanded from macro 'BOOST_SYSTEM_REQUIRE_CONST_INIT'
1># define BOOST_SYSTEM_REQUIRE_CONST_INIT
[[clang::require_constant_initialization]]
1> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1>m:\data\boost\boost\boost/system/error_code.hpp(226,41):Â note:
non-constexpr constructor 'error_category' cannot be used in a constant
expression
1>Â Â Â Â Â Â Â BOOST_SYSTEM_CONSTEXPR explicit std_category(
boost::system::error_category const * pc ): pc_( pc )
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>m:\data\boost\boost\boost/system/error_code.hpp(252,70):Â note: in
call to 'std_category(&generic_category_instance)'
1>Â Â Â Â Â BOOST_SYSTEM_CONSTEXPR error_category() BOOST_SYSTEM_NOEXCEPT:
std_cat_( this ) {}
1> ^
1>m:\data\boost\boost\boost/system/error_code.hpp(354,28):Â note: in
call to 'error_category()'
1>Â Â Â BOOST_SYSTEM_CONSTEXPR generic_error_category() BOOST_SYSTEM_NOEXCEPT
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>m:\data\boost\boost\boost/system/detail/error_code.ipp(459,74): note:
in call to 'generic_error_category()'
1>BOOST_SYSTEM_REQUIRE_CONST_INIT BOOST_SYSTEM_DECL
generic_error_category generic_category_instance;
1> ^
1>C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\include\system_error(168,18):Â note: declared here
1>Â Â Â Â Â Â Â /* constexpr */ error_category() _NOEXCEPTÂ Â Â Â Â // TRANSITION
1>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ^
1>1 warning and 3 errors generated.
I believe the error is correct as well: class std_category has virtual
member functions and so no constructor can ever be constexpr as the type
can never be a literal.
HTH, John.
--- This email has been checked for viruses by AVG. https://www.avg.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk